Skip to content

Instantly share code, notes, and snippets.

@arifsetyawan
Created August 28, 2022 09:06
Show Gist options
  • Select an option

  • Save arifsetyawan/e41bc1a9695afc30fc294f313475cb25 to your computer and use it in GitHub Desktop.

Select an option

Save arifsetyawan/e41bc1a9695afc30fc294f313475cb25 to your computer and use it in GitHub Desktop.

Revisions

  1. arifsetyawan created this gist Aug 28, 2022.
    17 changes: 17 additions & 0 deletions bad-request-error.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    import { CustomError } from "./custom-error";

    export class BadRequestError extends CustomError {
    statusCode = 400;
    reason = 'something went wrong';

    constructor(public message: string) {
    super(message);
    Object.setPrototypeOf(this, BadRequestError.prototype);
    }

    serializeError() {
    return [
    { message: this.message }
    ]
    }
    }