File tree Expand file tree Collapse file tree 3 files changed +3
-7
lines changed
Expand file tree Collapse file tree 3 files changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -23,9 +23,5 @@ export function isBaseError(
2323 return false ;
2424 }
2525
26- if ( ! isObject ( input . data ) ) {
27- return false ;
28- }
29-
3026 return typeof input . message === 'string' ;
3127}
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export class BaseError extends Error {
2222 * unstructured information or supplementary details that provide context
2323 * to the error.
2424 */
25- readonly data : ObjectLiteral ;
25+ readonly data ? : ObjectLiteral ;
2626
2727 /**
2828 * Determines whether the error message can be safely exposed externally.
@@ -73,6 +73,6 @@ export class BaseError extends Error {
7373 this . expose = options . expose ;
7474 this . logMessage = options . logMessage ;
7575 this . logLevel = options . logLevel ;
76- this . data = options . data || { } ;
76+ this . data = options . data ;
7777 }
7878}
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ describe('src/module.ts', () => {
2323 foo : 'bar' ,
2424 } ,
2525 } ) ;
26- expect ( error . code ) . toEqual ( 'bar' ) ;
26+ expect ( error . data ) . toEqual ( { foo : 'bar' } ) ;
2727 } ) ;
2828
2929 it ( 'should recognize error' , ( ) => {
You can’t perform that action at this time.
0 commit comments