@heathmont/lab-flask
Advanced tools
Comparing version 0.1.12 to 0.1.13
@@ -14,2 +14,3 @@ export interface ParameterError { | ||
export declare const handleLabError: <T>(errorResponse: T, kind: any) => LabError; | ||
export declare const handleInteralError: (e: Error) => LabError; | ||
export {}; |
@@ -29,2 +29,8 @@ "use strict"; | ||
}; | ||
exports.handleInteralError = (e) => { | ||
const error = exports.createLabError('INTERNAL'); | ||
exports.addParameterError(error, 'message', e.message); | ||
exports.addParameterError(error, 'stack', e.stack); | ||
return error; | ||
}; | ||
//# sourceMappingURL=errorHandler.js.map |
{ | ||
"name": "@heathmont/lab-flask", | ||
"version": "0.1.12", | ||
"version": "0.1.13", | ||
"author": "Margus Lamp", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
import { Proto } from '@heathmont/coingaming-protobuf'; | ||
import { handleLabError } from './errorHandler'; | ||
import { createLabError, handleInteralError, handleLabError } from './errorHandler'; | ||
@@ -24,2 +24,15 @@ describe('errorHandler', () => { | ||
it('should know how to create interal labError', () => { | ||
const error = createLabError('INTERNAL'); | ||
expect(error.type).toBe('INTERNAL'); | ||
}); | ||
it('should know how to create interal labError', () => { | ||
const error = handleInteralError(new Error('Error message')); | ||
const errors = error.errors; | ||
expect(errors.length).toBe(2); | ||
expect(errors.find(error => error.name === 'message').value).toBe('Error message'); | ||
expect(errors.find(error => error.name === 'stack').value.length > 0).toBe(true); | ||
}); | ||
}); |
@@ -47,1 +47,8 @@ export interface ParameterError { | ||
}; | ||
export const handleInteralError = (e: Error): LabError => { | ||
const error = createLabError('INTERNAL'); | ||
addParameterError(error, 'message', e.message); | ||
addParameterError(error, 'stack', e.stack); | ||
return error; | ||
}; |
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
95571
1673