@@ -3,27 +3,30 @@ import statusCodes, { getReasonPhrase } from 'http-status-codes';
33import { HttpError , HttpErrorOptions } from './http.error' ;
44
55export type HttpBadRequestErrorOptions < TError = any > = HttpErrorOptions & {
6-
76 /**
87 * Client errors
98 */
10- clientErrors : Array < TError >
11- }
12-
13- export class HttpBadRequest < TError = any > extends HttpError {
9+ clientErrors : Array < TError > ;
10+ } ;
1411
12+ export class HttpBadRequestError < TError = any > extends HttpError {
1513 /**
1614 * Client error(s)
1715 */
1816 public readonly clientErrors : Array < TError > ;
1917
20- constructor ( message ?: string , error ?: Error , opts ?: HttpBadRequestErrorOptions ) {
18+ constructor (
19+ message ?: string ,
20+ error ?: Error ,
21+ opts ?: HttpBadRequestErrorOptions ,
22+ ) {
2123 /* Initialization phase */
2224 const parentConstructorProps : HttpErrorOptions = {
23- statusCode : opts ?. statusCode || statusCodes . BAD_REQUEST
25+ statusCode : opts ?. statusCode || statusCodes . BAD_REQUEST ,
2426 } ;
2527
26- parentConstructorProps . statusMessage = opts ?. statusMessage || getReasonPhrase ( parentConstructorProps . statusCode ) ;
28+ parentConstructorProps . statusMessage =
29+ opts ?. statusMessage || getReasonPhrase ( parentConstructorProps . statusCode ) ;
2730 parentConstructorProps . isHandled = opts ?. isHandled || false ;
2831
2932 /* Call the constructor with overrided parameters */
@@ -33,9 +36,9 @@ export class HttpBadRequest<TError = any> extends HttpError {
3336 this . clientErrors = opts ?. clientErrors || [ ] ;
3437
3538 // set stacktrace
36- Error . captureStackTrace ( this , HttpBadRequest ) ;
39+ Error . captureStackTrace ( this , HttpBadRequestError ) ;
3740
3841 // Set prototype to make instanceOf enabled
39- Object . setPrototypeOf ( this , HttpBadRequest . prototype ) ;
42+ Object . setPrototypeOf ( this , HttpBadRequestError . prototype ) ;
4043 }
4144}
0 commit comments