@springworks/error-factory
Advanced tools
Comparing version 3005.335.1 to 3005.340.0
@@ -1,2 +0,3 @@ | ||
export type ClientHttpStatusCode = 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 422 | 425 | 426 | 428 | 429 | 431 | 451; | ||
import type { HTTP4XX } from '@springworks/http-status'; | ||
export type ClientHttpStatusCode = Extract<HTTP4XX, number>; | ||
export interface ErrorResponse { | ||
@@ -19,4 +20,7 @@ error: { | ||
export declare function createClientError(params: CreateClientErrorParams): ClientError; | ||
export declare function createClientErrorForResponse(response: any): ClientError; | ||
export declare function createClientErrorForResponse(response: { | ||
code: ClientHttpStatusCode; | ||
body?: ErrorResponse; | ||
}): ClientError; | ||
export declare function isClientError(input: unknown): input is ClientError; | ||
//# sourceMappingURL=client-error.d.ts.map |
@@ -10,8 +10,3 @@ "use strict"; | ||
this.client_http_status_code = client_http_status_code; | ||
this.error_response = { | ||
error: { | ||
code, | ||
message, | ||
}, | ||
}; | ||
this.error_response = { error: { code, message } }; | ||
this.name = 'ClientError'; | ||
@@ -18,0 +13,0 @@ } |
import { Output } from '@hapi/boom'; | ||
export declare function getStatusCode(code: any, cause: any): number; | ||
export declare function getRootErrorId(root_error_id: any, cause: any): string | undefined; | ||
export declare function isJoi(error: unknown): boolean; | ||
export declare function getStatusCode(code?: number, cause?: unknown): number; | ||
export declare function getRootErrorId(root_error_id?: string, cause?: unknown): string | undefined; | ||
export declare function isJoi(error: unknown): error is FelError & { | ||
_object?: unknown; | ||
annotate?: unknown; | ||
}; | ||
export declare function toStringDebug(this: FelError & { | ||
@@ -28,2 +31,4 @@ annotate?: () => string; | ||
}; | ||
_object?: unknown; | ||
annotate?: unknown; | ||
} | ||
@@ -33,3 +38,3 @@ export interface CreateErrorParams { | ||
message?: string; | ||
cause?: any; | ||
cause?: unknown; | ||
root_error_id?: string; | ||
@@ -36,0 +41,0 @@ stack_from?(...a: any[]): any; |
@@ -77,3 +77,9 @@ "use strict"; | ||
} | ||
if ((_b = cause === null || cause === void 0 ? void 0 : cause.output) === null || _b === void 0 ? void 0 : _b.headers) { | ||
if (typeof cause === 'object' && | ||
cause !== null && | ||
'output' in cause && | ||
typeof cause.output === 'object' && | ||
cause.output !== null && | ||
'headers' in cause.output && | ||
((_b = cause === null || cause === void 0 ? void 0 : cause.output) === null || _b === void 0 ? void 0 : _b.headers)) { | ||
error.output.headers = cause.output.headers; | ||
@@ -80,0 +86,0 @@ } |
@@ -1,3 +0,4 @@ | ||
export declare function createLogPayloadDescriptor(): any; | ||
export declare function getOutputPayload(this: any): any; | ||
import type { FelError } from './fel'; | ||
export declare function createLogPayloadDescriptor(): PropertyDescriptor; | ||
export declare function getOutputPayload(this: FelError): import("@hapi/boom").Payload | undefined; | ||
//# sourceMappingURL=internals.d.ts.map |
@@ -18,5 +18,6 @@ "use strict"; | ||
function getOutputPayload() { | ||
return this.output.payload; | ||
var _a; | ||
return (_a = this.output) === null || _a === void 0 ? void 0 : _a.payload; | ||
} | ||
exports.getOutputPayload = getOutputPayload; | ||
//# sourceMappingURL=internals.js.map |
@@ -8,7 +8,7 @@ import { isClientError, ClientError, ClientHttpStatusCode, createClientError, CreateClientErrorParams, ErrorResponse, createClientErrorForResponse } from './client-error/client-error'; | ||
message?: string; | ||
cause?: any; | ||
cause?: unknown; | ||
root_error_id?: string; | ||
stack_from?(...a: any[]): any; | ||
stack_from?(...a: unknown[]): unknown; | ||
} | ||
export declare function createError(params?: CreateErrorParams | unknown): FelError; | ||
export declare function createError<T = CreateErrorParams>(params?: T): FelError; | ||
//# sourceMappingURL=main.d.ts.map |
@@ -31,6 +31,9 @@ "use strict"; | ||
toJSON: { | ||
value: () => ({ | ||
...error.output.payload, // old goodies like root_error_id, error_id and statusCode | ||
...(params ? pickHumanFriendlyInput(params) : undefined), | ||
}), | ||
value: () => { | ||
var _a; | ||
return ({ | ||
...(_a = error.output) === null || _a === void 0 ? void 0 : _a.payload, // old goodies like root_error_id, error_id and statusCode | ||
...(params ? pickHumanFriendlyInput(params) : undefined), | ||
}); | ||
}, | ||
enumerable: true, | ||
@@ -37,0 +40,0 @@ }, |
{ | ||
"name": "@springworks/error-factory", | ||
"version": "3005.335.1", | ||
"version": "3005.340.0", | ||
"description": "Custom error that makes use of HTTP error codes to identify different error types.", | ||
@@ -13,2 +13,3 @@ "main": "build/main.js", | ||
"@hapi/boom": "^9.1.4", | ||
"@springworks/http-status": "3005.335.1", | ||
"@springworks/random-string": "3005.329.0", | ||
@@ -29,3 +30,3 @@ "@springworks/swagger-schema-interfaces": "3005.335.1" | ||
"homepage": "https://github.com/Springworks/m2h-mono/tree/master/packages/error-factory#readme", | ||
"gitHead": "a4c6f770db51939405a306f5daf692284db2c598" | ||
"gitHead": "e2b58af8be31c9299eb276248c34f3eaea6859d5" | ||
} |
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36448
327
4