Last active
October 31, 2022 21:11
-
-
Save ciscoheat/cca1f769c0e7cbf9dfb7d7bc25653c5c to your computer and use it in GitHub Desktop.
Revisions
-
ciscoheat revised this gist
Oct 31, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ export class APIError extends Error implements Problem { detail?: string; instance?: string; constructor(details: Problem) { super([details.title, details.detail].join('\n')); this.type = details.type ?? 'about:blank'; -
ciscoheat revised this gist
Oct 31, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ import type { Problem } from './Problem' /** * Javascript error class based on RFC7807. -
ciscoheat revised this gist
Oct 31, 2022 . 2 changed files with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,10 @@ import { Problem } from './Problem' /** * Javascript error class based on RFC7807. * @link https://www.rfc-editor.org/rfc/rfc7807 */ export class APIError extends Error implements Problem { type: string; title?: string; status?: number; This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ * Interface for a RFC7807 Problem Details Object. * @see https://www.rfc-editor.org/rfc/rfc7807 */ export interface Problem { /** * A URI reference [RFC3986] that identifies the problem type. This specification encourages that, when dereferenced, it provide human-readable documentation for the problem type (e.g., using HTML [W3C.REC-html5-20141028]). When this member is not present, its value is assumed to be "about:blank". */ -
ciscoheat created this gist
Oct 31, 2022 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ import { RFC7807 } from './RFC7807' /** * Javascript error class based on RFC7807. * @link https://www.rfc-editor.org/rfc/rfc7807 */ export class APIError extends Error implements RFC7807 { type: string; title?: string; status?: number; detail?: string; instance?: string; constructor(details: RFC7807) { super([details.title, details.detail].join('\n')); this.type = details.type ?? 'about:blank'; this.title = details.title; this.status = details.status; this.detail = details.detail; this.instance = details.instance; } } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ /** * Interface for a RFC7807 Problem Details Object. * @see https://www.rfc-editor.org/rfc/rfc7807 */ export interface RFC7807 { /** * A URI reference [RFC3986] that identifies the problem type. This specification encourages that, when dereferenced, it provide human-readable documentation for the problem type (e.g., using HTML [W3C.REC-html5-20141028]). When this member is not present, its value is assumed to be "about:blank". */ type?: string; /** * A short, human-readable summary of the problem type. It SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization (e.g., using proactive content negotiation; see [RFC7231, Section 3.4]). */ title?: string; /** * The HTTP status code ([RFC7231], Section 6) generated by the origin server for this occurrence of the problem. */ status?: number; /** * A human-readable explanation specific to this occurrence of the problem. */ detail?: string; /** * A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced. */ instance?: string; }