UNPKG

net-exceptions

Version:

Provides lightweight versions of the most important exceptions from Microsoft's .NET

63 lines 1.87 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const util_1 = require("util"); /** * Represents errors that occur during application execution. */ class Exception extends Error { /** * Initializes a new instance of the `Exception` class. * * @param message * A message that describes the current exception. * * @param innerException * The Exception instance that caused the current exception. */ constructor(message, innerException) { super(message); /** * The Exception instance that caused the current exception. */ this.innerException = null; if (innerException) { this.innerException = innerException; } } /** * Gets a collection of key/value pairs that provide additional user-defined information about the exception. */ get Data() { return this.data; } /** * Gets the Exception instance that caused the current exception. */ get InnerException() { return this.innerException; } /** * Gets a message that describes the current exception. */ get Message() { return this.message; } /** * Gets a string representation of the immediate frames on the call stack. */ get StackTrace() { return this.stack; } /** * When overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions. */ GetBaseException() { let exception = this; while (!util_1.isNullOrUndefined(exception.InnerException)) { exception = exception.InnerException; } return exception; } } exports.Exception = Exception; //# sourceMappingURL=Exception.js.map