From afb8bca54a8982b435cb5fae2a509abd8b75ce69 Mon Sep 17 00:00:00 2001 From: Razvan Muscalu <34776591+RazzM13@users.noreply.github.com> Date: Mon, 21 Jan 2019 22:16:15 +0200 Subject: [PATCH 1/5] [@types/feathersjs__errors] Added typings for the missing "code", "className", "data" and "errors" property members of the FeathersError object. --- types/feathersjs__errors/index.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/feathersjs__errors/index.d.ts b/types/feathersjs__errors/index.d.ts index 056acff676..9adcdc6dbf 100644 --- a/types/feathersjs__errors/index.d.ts +++ b/types/feathersjs__errors/index.d.ts @@ -5,7 +5,11 @@ // TypeScript Version: 2.2 export class FeathersError extends Error { - constructor(msg: string | Error, name: string, code: number, className: string, data: any) + code: number; + className: string; + data: any; + errors: any; + constructor(msg: string | Error, name: string, code: number, className: string, data: any); } export class BadRequest extends FeathersError { From 3c55900c9c6c09ca616377e4a66d0fb62f85314a Mon Sep 17 00:00:00 2001 From: Razvan Muscalu <34776591+RazzM13@users.noreply.github.com> Date: Mon, 21 Jan 2019 22:16:46 +0200 Subject: [PATCH 2/5] [@types/feathersjs__errors] Added "RazzM13" to "Definitions by" section as per the contribution guidelines. --- types/feathersjs__errors/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/feathersjs__errors/index.d.ts b/types/feathersjs__errors/index.d.ts index 9adcdc6dbf..01969de8a3 100644 --- a/types/feathersjs__errors/index.d.ts +++ b/types/feathersjs__errors/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for @feathersjs/errors 3.2 // Project: http://feathersjs.com/ // Definitions by: Jan Lohage +// RazzM13 // Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript // TypeScript Version: 2.2 From 7203a2a86763485d1b6152a1dcac381ddc495bfe Mon Sep 17 00:00:00 2001 From: Razvan Muscalu <34776591+RazzM13@users.noreply.github.com> Date: Thu, 7 Feb 2019 10:59:41 +0200 Subject: [PATCH 3/5] [@types/feathersjs__errors] Bumped version to 3.3. --- types/feathersjs__errors/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/feathersjs__errors/index.d.ts b/types/feathersjs__errors/index.d.ts index 01969de8a3..3a94e4cd50 100644 --- a/types/feathersjs__errors/index.d.ts +++ b/types/feathersjs__errors/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for @feathersjs/errors 3.2 +// Type definitions for @feathersjs/errors 3.3 // Project: http://feathersjs.com/ // Definitions by: Jan Lohage // RazzM13 From a9259ab52140a3c0d35799d1c8072a86c34a7b78 Mon Sep 17 00:00:00 2001 From: Razvan Muscalu <34776591+RazzM13@users.noreply.github.com> Date: Thu, 7 Feb 2019 11:04:29 +0200 Subject: [PATCH 4/5] [@types/feathersjs__errors] Made "FeathersError" specific properties readonly. --- types/feathersjs__errors/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/feathersjs__errors/index.d.ts b/types/feathersjs__errors/index.d.ts index 3a94e4cd50..ab7b1eae34 100644 --- a/types/feathersjs__errors/index.d.ts +++ b/types/feathersjs__errors/index.d.ts @@ -6,10 +6,10 @@ // TypeScript Version: 2.2 export class FeathersError extends Error { - code: number; - className: string; - data: any; - errors: any; + readonly code: number; + readonly className: string; + readonly data: any; + readonly errors: any; constructor(msg: string | Error, name: string, code: number, className: string, data: any); } From 12738483e6597664a21ab33ecb5ba3ac109bb433 Mon Sep 17 00:00:00 2001 From: Razvan Muscalu <34776591+RazzM13@users.noreply.github.com> Date: Thu, 7 Feb 2019 11:09:17 +0200 Subject: [PATCH 5/5] [@types/feathersjs__errors] Added the missing "toJSON" function of the "FeathersError" base class that returns an object suitable for serialization. --- types/feathersjs__errors/index.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/types/feathersjs__errors/index.d.ts b/types/feathersjs__errors/index.d.ts index ab7b1eae34..3994e2056c 100644 --- a/types/feathersjs__errors/index.d.ts +++ b/types/feathersjs__errors/index.d.ts @@ -5,12 +5,22 @@ // Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript // TypeScript Version: 2.2 +export interface FeathersErrorJSON { + readonly name: string; + readonly message: string; + readonly code: number; + readonly className: string; + readonly data: any; + readonly errors: any; +} + export class FeathersError extends Error { readonly code: number; readonly className: string; readonly data: any; readonly errors: any; constructor(msg: string | Error, name: string, code: number, className: string, data: any); + toJSON(): FeathersErrorJSON; } export class BadRequest extends FeathersError {