UNPKG

decova-dotnet

Version:

This package provides fundumentals that a .net developer may miss while working with Typescript, whether they are missing functinalities or funcionalities provided in a non-elegant design in javascript. Bad naming, bad design of optional parameters, non-c

57 lines 2.39 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Exception_InvalidProgramState = exports.Exception_UnintendedExecutionPath = exports.Exception_ArgumentNull = exports.Exception_InvalidOperation = exports.Exception_ArgumentInvalid = exports.Exception = void 0; class Exception extends Error { constructor(message, innerException = null) { super(message); this.message = message; this.innerException = innerException; this.logError(); } static FromError(error) { return new Exception(error.message); } logError() { var _a; (_a = this.innerException) === null || _a === void 0 ? void 0 : _a.logError(); console.error(this.message); console.error(this.stack); } } exports.Exception = Exception; class Exception_ArgumentInvalid extends Exception { constructor(argumentName, value, description = null, innerException = null) { super(`Invalid argument: {${argumentName} = ${value}} is invalid.\r\n${description}`, innerException); this.argumentName = argumentName; this.value = value; this.description = description; } } exports.Exception_ArgumentInvalid = Exception_ArgumentInvalid; class Exception_InvalidOperation extends Exception { constructor(message, innerException = null) { super(message, innerException); } } exports.Exception_InvalidOperation = Exception_InvalidOperation; class Exception_ArgumentNull extends Exception { constructor(message, innerException = null) { super(message, innerException); } } exports.Exception_ArgumentNull = Exception_ArgumentNull; class Exception_UnintendedExecutionPath extends Exception { constructor(message, innerException = null) { super(message, innerException); } } exports.Exception_UnintendedExecutionPath = Exception_UnintendedExecutionPath; class Exception_InvalidProgramState extends Exception { constructor(invalidVarName, description, innerException = null) { super(`Invalid program state at var:${invalidVarName}\r\n ${description}`, innerException); this.description = description; this.innerException = innerException; } } exports.Exception_InvalidProgramState = Exception_InvalidProgramState; //# sourceMappingURL=Exceptions.js.map