@springworks/error-factory
Advanced tools
Comparing version 3005.79.0 to 3005.80.0
@@ -34,3 +34,3 @@ import { Output } from '@hapi/boom'; | ||
} | ||
export declare function createError(params?: CreateErrorParams | unknown): FelError; | ||
export declare function createError(params?: CreateErrorParams): FelError; | ||
//# sourceMappingURL=fel.d.ts.map |
@@ -49,3 +49,3 @@ "use strict"; | ||
function useParamsOrDefaults(params) { | ||
if (!params || typeof params !== 'object' || params === null) { | ||
if (!params || typeof params !== 'object') { | ||
return {}; | ||
@@ -52,0 +52,0 @@ } |
@@ -13,4 +13,4 @@ import { ClientError, ClientHttpStatusCode, createClientError, CreateClientErrorParams, ErrorResponse, createClientErrorForResponse } from './client-error/client-error'; | ||
} | ||
export declare function createError(params?: CreateErrorParams): FelError; | ||
export declare function createError(params?: CreateErrorParams | unknown): FelError; | ||
export declare function isFelError(input: unknown): input is FelError; | ||
//# sourceMappingURL=main.d.ts.map |
@@ -12,7 +12,17 @@ "use strict"; | ||
const internals_1 = require("./internals"); | ||
function createError(params = {}) { | ||
if (!params.stack_from) { | ||
params.stack_from = createError; | ||
// The reason for allowing unknown is because we are using this function mostly | ||
// in a try/catch, where the current typescript version states that whatever | ||
// catch returns is always unknown. | ||
function createError(params) { | ||
let create_error_params; | ||
if (!params || typeof params !== 'object' || params === null) { | ||
create_error_params = {}; | ||
} | ||
const error = fel_1.createError(params); | ||
else { | ||
create_error_params = params; | ||
} | ||
if (!create_error_params.stack_from) { | ||
create_error_params.stack_from = createError; | ||
} | ||
const error = fel_1.createError(create_error_params); | ||
Object.defineProperties(error, { | ||
@@ -19,0 +29,0 @@ toJSON: { value: internals_1.getOutputPayload, enumerable: true }, |
@@ -6,2 +6,13 @@ # Change Log | ||
# [3005.80.0](https://github.com/Springworks/m2h-mono/compare/v3005.79.0...v3005.80.0) (2021-09-21) | ||
### Features | ||
* **error-factory:** allow unknown as input for main export ([0f3ff19](https://github.com/Springworks/m2h-mono/commit/0f3ff19c241094fbc171ce67d1522996710105ee)) | ||
# [3005.79.0](https://github.com/Springworks/m2h-mono/compare/v3005.78.2...v3005.79.0) (2021-09-21) | ||
@@ -8,0 +19,0 @@ |
{ | ||
"name": "@springworks/error-factory", | ||
"version": "3005.79.0", | ||
"version": "3005.80.0", | ||
"description": "Custom error that makes use of HTTP error codes to identify different error types.", | ||
@@ -29,3 +29,3 @@ "main": "build/main.js", | ||
"homepage": "https://github.com/Springworks/m2h-mono/tree/master/packages/error-factory#readme", | ||
"gitHead": "5ac3ae4cd5229c0e560c8594f6004a47880de7c1" | ||
"gitHead": "bcef4e73278b1d62c4aac263767838566c4c65c4" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
45842
527