Skip to content

Commit

Permalink
fix(errors): Add 410 Gone to errors (#1849)
Browse files Browse the repository at this point in the history
Co-authored-by: Joe Nardone <joe@wirewheel.io>
  • Loading branch information
jnardone and Joe Nardone committed Mar 24, 2020
1 parent 854c9ca commit 6801428
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/errors/lib/index.js
Expand Up @@ -144,6 +144,13 @@ function Conflict (message, data) {

inheritsFrom(Conflict, FeathersError);

// 410 - Gone
function Gone (message, data) {
FeathersError(this, message, 'Gone', 410, 'gone', data);
}

inheritsFrom(Gone, FeathersError);

// 411 - Length Required
function LengthRequired (message, data) {
FeathersError.call(this, message, 'LengthRequired', 411, 'length-required', data);
Expand Down Expand Up @@ -204,6 +211,7 @@ const errors = {
NotAcceptable,
Timeout,
Conflict,
Gone,
LengthRequired,
Unprocessable,
TooManyRequests,
Expand All @@ -220,6 +228,7 @@ const errors = {
406: NotAcceptable,
408: Timeout,
409: Conflict,
410: Gone,
411: LengthRequired,
422: Unprocessable,
429: TooManyRequests,
Expand Down
8 changes: 8 additions & 0 deletions packages/errors/test/index.test.js
Expand Up @@ -78,6 +78,10 @@ describe('@feathersjs/errors', () => {
assert.notStrictEqual(typeof errors.Conflict, 'undefined', 'has Conflict');
});

it('Gone', () => {
assert.notStrictEqual(typeof errors.Gone, 'undefined', 'has Gone');
});

it('Length Required', () => {
assert.notStrictEqual(typeof errors.LengthRequired, 'undefined', 'has LengthRequired');
});
Expand Down Expand Up @@ -142,6 +146,10 @@ describe('@feathersjs/errors', () => {
assert.notStrictEqual(typeof errors[409], 'undefined', 'has Conflict alias');
});

it('410', () => {
assert.notStrictEqual(typeof errors[410], 'undefined', 'has Gone alias');
});

it('411', () => {
assert.notStrictEqual(typeof errors[411], 'undefined', 'has LengthRequired alias');
});
Expand Down

0 comments on commit 6801428

Please sign in to comment.