From 6801428f8fd17dbfebcdb6f1b0cd01433a4033dc Mon Sep 17 00:00:00 2001 From: jnardone Date: Tue, 24 Mar 2020 00:16:56 -0400 Subject: [PATCH] fix(errors): Add 410 Gone to errors (#1849) Co-authored-by: Joe Nardone --- packages/errors/lib/index.js | 9 +++++++++ packages/errors/test/index.test.js | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/packages/errors/lib/index.js b/packages/errors/lib/index.js index b775ed174..b1f5ca712 100644 --- a/packages/errors/lib/index.js +++ b/packages/errors/lib/index.js @@ -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); @@ -204,6 +211,7 @@ const errors = { NotAcceptable, Timeout, Conflict, + Gone, LengthRequired, Unprocessable, TooManyRequests, @@ -220,6 +228,7 @@ const errors = { 406: NotAcceptable, 408: Timeout, 409: Conflict, + 410: Gone, 411: LengthRequired, 422: Unprocessable, 429: TooManyRequests, diff --git a/packages/errors/test/index.test.js b/packages/errors/test/index.test.js index ec55d1e9d..1b14ae4bc 100644 --- a/packages/errors/test/index.test.js +++ b/packages/errors/test/index.test.js @@ -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'); }); @@ -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'); });