-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5bf7788
commit 4b09c78
Showing
6 changed files
with
60 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
const HttpError = require('./http-error'); | ||
|
||
/** | ||
* Export `AssertionFailedError`. | ||
*/ | ||
|
||
module.exports = class AssertionFailedError extends HttpError { | ||
/** | ||
* Constructor. | ||
*/ | ||
|
||
constructor(errors) { | ||
super(500, 'Assertion Failed', { errors }); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
const { AssertionFailedError } = require('../../src'); | ||
const test = require('../utils/test-http-error'); | ||
|
||
/** | ||
* Test "Assertion Failed" error. | ||
*/ | ||
|
||
describe('AssertionFailedError', () => { | ||
test(AssertionFailedError, 500, 'Assertion Failed', false); | ||
|
||
it('should set given `errors`', () => { | ||
expect(new AssertionFailedError('foo').errors).toBe('foo'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { HttpError } from './http-error'; | ||
export declare class AssertionFailedError extends HttpError { | ||
errors?: object; | ||
|
||
constructor(errors?: object); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters