leandreAlly/error-ease

View on GitHub
src/errors/custom-error.ts

Summary

Maintainability
A
0 mins
Test Coverage
export abstract class CustomError extends Error {
  abstract statusCode: number;

  constructor(message: string) {
    super(message);

    Object.setPrototypeOf(this, CustomError.prototype);
  }

  abstract serializeErrors(): { message: string; field?: string }[];
}