This repository has been archived by the owner on May 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: HttpException and his inherited exception accept an origin para…
…meters
Closes: #4
- Loading branch information
Showing
50 changed files
with
255 additions
and
171 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
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 |
---|---|---|
@@ -1,16 +1,10 @@ | ||
import {Exception} from "../core/Exception"; | ||
|
||
/** | ||
* | ||
*/ | ||
export class BadMapping extends Exception { | ||
static readonly STATUS = 421; | ||
name: string = "BAD_MAPPING"; | ||
|
||
/** | ||
* | ||
* @param message | ||
*/ | ||
constructor(message: string) { | ||
super(421, message); | ||
constructor(message: string, origin?: Error | string | any) { | ||
super(BadMapping.STATUS, message, origin); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import {Exception} from "../core/Exception"; | ||
|
||
export class BadRequest extends Exception { | ||
static readonly STATUS = 400; | ||
name: string = "BAD_REQUEST"; | ||
|
||
constructor(message: string) { | ||
super(400, message); | ||
constructor(message: string, origin?: Error | string | any) { | ||
super(BadRequest.STATUS, message, origin); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import {Exception} from "../core/Exception"; | ||
|
||
export class Conflict extends Exception { | ||
static readonly STATUS = 409; | ||
name: string = "CONFLICT"; | ||
|
||
constructor(message: string) { | ||
super(409, message); | ||
constructor(message: string, origin?: Error | string | any) { | ||
super(Conflict.STATUS, message, origin); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import {Exception} from "../core/Exception"; | ||
|
||
export class ExpectationFailed extends Exception { | ||
static readonly STATUS = 417; | ||
name: string = "EXPECTATION_FAILED"; | ||
|
||
constructor(message: string) { | ||
super(417, message); | ||
constructor(message: string, origin?: Error | string | any) { | ||
super(ExpectationFailed.STATUS, message, origin); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import {Exception} from "../core/Exception"; | ||
|
||
export class Forbidden extends Exception { | ||
static readonly STATUS = 403; | ||
name: string = "FORBIDDEN"; | ||
|
||
constructor(message: string) { | ||
super(403, message); | ||
constructor(message: string, origin?: Error | string | any) { | ||
super(Forbidden.STATUS, message, origin); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import {Exception} from "../core/Exception"; | ||
|
||
export class Gone extends Exception { | ||
static readonly STATUS = 410; | ||
name: string = "GONE"; | ||
|
||
constructor(message: string) { | ||
super(410, message); | ||
constructor(message: string, origin?: Error | string | any) { | ||
super(Gone.STATUS, message, origin); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import {Exception} from "../core/Exception"; | ||
|
||
export class ImATeapot extends Exception { | ||
static readonly STATUS = 418; | ||
name: string = "IM_A_TEAPOT"; | ||
|
||
constructor(message: string) { | ||
super(418, message); | ||
constructor(message: string, origin?: Error | string | any) { | ||
super(ImATeapot.STATUS, message, origin); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import {Exception} from "../core/Exception"; | ||
|
||
export class LengthRequired extends Exception { | ||
static readonly STATUS = 411; | ||
name: string = "LENGTH_REQUIRED"; | ||
|
||
constructor(message: string) { | ||
super(411, message); | ||
constructor(message: string, origin?: Error | string | any) { | ||
super(LengthRequired.STATUS, message, origin); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import {Exception} from "../core/Exception"; | ||
|
||
export class MethodNotAllowed extends Exception { | ||
static readonly STATUS = 405; | ||
name: string = "METHOD_NOT_ALLOWED"; | ||
|
||
constructor(message: string) { | ||
super(405, message); | ||
constructor(message: string, origin?: Error | string | any) { | ||
super(MethodNotAllowed.STATUS, message, origin); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import {Exception} from "../core/Exception"; | ||
|
||
export class MisdirectedRequest extends Exception { | ||
static readonly STATUS = 421; | ||
name: string = "MISDIRECTED_REQUEST"; | ||
|
||
constructor(message: string) { | ||
super(421, message); | ||
constructor(message: string, origin?: Error | string | any) { | ||
super(MisdirectedRequest.STATUS, message, origin); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import {Exception} from "../core/Exception"; | ||
|
||
export class NotAcceptable extends Exception { | ||
static readonly STATUS = 406; | ||
name: string = "NOT_ACCEPTABLE"; | ||
|
||
constructor(message: string) { | ||
super(406, "You must accept content-type " + message); | ||
constructor(message: string, origin: Error | string | any = "You must accept content-type " + message) { | ||
super(NotAcceptable.STATUS, origin); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import {Exception} from "../core/Exception"; | ||
|
||
export class NotFound extends Exception { | ||
static readonly STATUS = 404; | ||
name: string = "NOT_FOUND"; | ||
|
||
constructor(message: string) { | ||
super(404, message); | ||
constructor(message: string, origin?: Error | string | any) { | ||
super(NotFound.STATUS, message, origin); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import {Exception} from "../core/Exception"; | ||
|
||
export class PaymentRequired extends Exception { | ||
static readonly STATUS = 402; | ||
name: string = "PAYMENT_REQUIRED"; | ||
|
||
constructor(message: string) { | ||
super(402, message); | ||
constructor(message: string, origin?: Error | string | any) { | ||
super(PaymentRequired.STATUS, message, origin); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import {Exception} from "../core/Exception"; | ||
|
||
export class PreconditionFailed extends Exception { | ||
static readonly STATUS = 412; | ||
name: string = "PRECONDITION_FAILED"; | ||
|
||
constructor(message: string) { | ||
super(412, message); | ||
constructor(message: string, origin?: Error | string | any) { | ||
super(PreconditionFailed.STATUS, message, origin); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import {Exception} from "../core/Exception"; | ||
|
||
export class PreconditionRequired extends Exception { | ||
static readonly STATUS = 428; | ||
name: string = "PRECONDITION_REQUIRED"; | ||
|
||
constructor(message: string) { | ||
super(428, message); | ||
constructor(message: string, origin?: Error | string | any) { | ||
super(PreconditionRequired.STATUS, message, origin); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import {Exception} from "../core/Exception"; | ||
|
||
export class ProxyAuthentificationRequired extends Exception { | ||
static readonly STATUS = 407; | ||
name: string = "PROXY_AUTHENTIFICATION_REQUIRED"; | ||
|
||
constructor(message: string) { | ||
super(407, message); | ||
constructor(message: string, origin?: Error | string | any) { | ||
super(ProxyAuthentificationRequired.STATUS, message, origin); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import {Exception} from "../core/Exception"; | ||
|
||
export class RequestEntityTooLarge extends Exception { | ||
static readonly STATUS = 413; | ||
name: string = "REQUEST_ENTITY_TOO_LARGE"; | ||
|
||
constructor(message: string) { | ||
super(413, message); | ||
constructor(message: string, origin?: Error | string | any) { | ||
super(RequestEntityTooLarge.STATUS, message, origin); | ||
} | ||
} |
Oops, something went wrong.