@injectivelabs/exceptions
Advanced tools
Comparing version 1.0.43 to 1.0.44
@@ -16,2 +16,7 @@ import { Exception, ErrorType, ErrorContext, ErrorCode, ErrorContextCode } from './types'; | ||
/** | ||
* Providing more context | ||
* (ex: endpoint on http request) | ||
*/ | ||
context?: string; | ||
/** | ||
* Providing more context as to where the exception was thrown | ||
@@ -41,5 +46,6 @@ * (ex: on-chain module, etc) | ||
parseError(error: Error): void; | ||
parseContext(context?: ErrorContext): void; | ||
parseContext(errorContext?: ErrorContext): void; | ||
setType(type: ErrorType): void; | ||
setCode(code: ErrorCode): void; | ||
setContext(context: string): void; | ||
setStack(stack: string): void; | ||
@@ -46,0 +52,0 @@ setName(name: string): void; |
@@ -42,8 +42,10 @@ "use strict"; | ||
} | ||
parseContext(context) { | ||
const { contextModule, type, code } = context || { | ||
parseContext(errorContext) { | ||
const { contextModule, type, code, context } = errorContext || { | ||
contextModule: '', | ||
context: '', | ||
code: types_1.UnspecifiedErrorCode, | ||
type: types_1.ErrorType.Unspecified, | ||
}; | ||
this.context = context; | ||
this.contextModule = contextModule; | ||
@@ -59,2 +61,5 @@ this.type = type || types_1.ErrorType.Unspecified; | ||
} | ||
setContext(context) { | ||
this.context = context; | ||
} | ||
setStack(stack) { | ||
@@ -95,2 +100,3 @@ super.stack = stack; | ||
type: this.type, | ||
context: this.context, | ||
contextModule: this.contextModule, | ||
@@ -97,0 +103,0 @@ contextCode: this.contextCode, |
@@ -7,4 +7,5 @@ import { ConcreteException } from '../exception'; | ||
method?: HttpRequestMethod; | ||
endpoint?: string; | ||
}); | ||
} | ||
//# sourceMappingURL=HttpRequestException.d.ts.map |
@@ -24,2 +24,9 @@ import { ErrorCode, ErrorContextCode } from './codes'; | ||
type?: ErrorType; | ||
/** | ||
* Additional context needed for the exception | ||
*/ | ||
context?: string; | ||
/** | ||
* Where is the exception thrown | ||
*/ | ||
contextModule?: string; | ||
@@ -26,0 +33,0 @@ /** |
{ | ||
"name": "@injectivelabs/exceptions", | ||
"description": "List of exceptions that can be reused throughout Injective's projects.", | ||
"version": "1.0.43", | ||
"version": "1.0.44", | ||
"license": "Apache-2.0", | ||
@@ -40,3 +40,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "ecce6f88a5090ca1b67a261bf10183121710c5f5" | ||
"gitHead": "56acd4e223db018fb34b390f16b84f107e0880f6" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
177239
2460