Fix RecurringError::toString
Summary: RecurringError::toString wasn't including the message. Fixed. Reviewed By: passy Differential Revision: D13732258 fbshipit-source-id: 71f5edef19de4e59d1c6c5bd549822871e36ede4
This commit is contained in:
committed by
Facebook Github Bot
parent
82f4d4ad95
commit
dfe956ab39
16
src/utils/__tests__/errors.node.js
Normal file
16
src/utils/__tests__/errors.node.js
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Copyright 2018-present Facebook.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {RecurringError} from '../errors';
|
||||
|
||||
test('Check RecurringError toString output', () => {
|
||||
const error = new RecurringError('something');
|
||||
expect(error.toString()).toBe('[RecurringError] something');
|
||||
/* $FlowFixMe intentionally coercing it to a string to make sure the correct
|
||||
method is overridden */
|
||||
expect('' + error).toBe('[RecurringError] something');
|
||||
});
|
||||
@@ -11,4 +11,7 @@ export class RecurringError extends Error {
|
||||
super(message);
|
||||
this.name = 'RecurringError';
|
||||
}
|
||||
toString(): string {
|
||||
return `[${this.name}] ${this.message}`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user