@golemio/errors
Advanced tools
Comparing version 2.0.3-dev.974281009 to 2.0.3-dev.1169413234
import { IGolemioErrorInfoType } from "./interfaces/GolemioErrorInterface"; | ||
import { IGolemioError } from "./interfaces/GolemioErrorInterface"; | ||
export declare abstract class AbstractGolemioError extends Error { | ||
moduleName?: string | undefined; | ||
queueName?: string | undefined; | ||
className?: string; | ||
status?: number; | ||
info?: IGolemioErrorInfoType; | ||
constructor(message: string, className?: string, info?: IGolemioErrorInfoType, status?: number); | ||
constructor(message: string, className?: string, info?: IGolemioErrorInfoType, status?: number, moduleName?: string | undefined, queueName?: string | undefined); | ||
toString: () => string; | ||
@@ -9,0 +11,0 @@ toObject: () => IGolemioError; |
@@ -5,4 +5,6 @@ "use strict"; | ||
class AbstractGolemioError extends Error { | ||
constructor(message, className, info, status) { | ||
constructor(message, className, info, status, moduleName, queueName) { | ||
super(message); | ||
this.moduleName = moduleName; | ||
this.queueName = queueName; | ||
this.toString = () => { | ||
@@ -13,5 +15,7 @@ return `${this.className ? `${this.className}: ` : ``}` | ||
+ `${this.info ? ` (${this.infoToString(this.info)})` : ``}` | ||
+ `${this.moduleName ? ` module: ${this.moduleName}` : ``}` | ||
+ `${this.queueName ? ` queue: ${this.queueName}` : ``}` | ||
+ `${process.env.NODE_ENV === "development" ? `\n ${this.stack}` : ``}`; | ||
}; | ||
this.toObject = () => (Object.assign(Object.assign(Object.assign(Object.assign({ error_message: this.message }, (this.className && { error_class_name: this.className })), (this.status && { error_status: this.status })), this.info && { error_info: this.infoToString(this.info) }), (process.env.NODE_ENV === "development") && { error_stack: this.stack })); | ||
this.toObject = () => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ error_message: this.message }, (this.className && { error_class_name: this.className })), (this.status && { error_status: this.status })), this.info && { error_info: this.infoToString(this.info) }), (process.env.NODE_ENV === "development") && { error_stack: this.stack }), (this.moduleName && { error_module_name: this.moduleName })), (this.queueName && { error_queue_name: this.queueName }))); | ||
this.name = this.constructor.name; | ||
@@ -18,0 +22,0 @@ this.message = message; |
import { AbstractGolemioError } from "./AbstractGolemioError"; | ||
import { IGolemioErrorInfoType } from "./interfaces/GolemioErrorInterface"; | ||
export declare class FatalError extends AbstractGolemioError { | ||
constructor(message: string, className?: string, info?: IGolemioErrorInfoType); | ||
constructor(message: string, className?: string, info?: IGolemioErrorInfoType, moduleName?: string, queueName?: string); | ||
} |
@@ -6,4 +6,4 @@ "use strict"; | ||
class FatalError extends AbstractGolemioError_1.AbstractGolemioError { | ||
constructor(message, className, info) { | ||
super(message, className, info, undefined); | ||
constructor(message, className, info, moduleName, queueName) { | ||
super(message, className, info, undefined, moduleName, queueName); | ||
} | ||
@@ -10,0 +10,0 @@ } |
@@ -7,2 +7,4 @@ export interface IGolemioError { | ||
error_stack?: string; | ||
error_module_name?: string; | ||
error_queue_name?: string; | ||
} | ||
@@ -9,0 +11,0 @@ export interface ICustomErrorObject extends IGolemioError { |
{ | ||
"name": "@golemio/errors", | ||
"version": "2.0.3-dev.974281009", | ||
"version": "2.0.3-dev.1169413234", | ||
"description": "Library of Error classes of the Golemio Data Platform System", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
38015
457