Skip to content

Error – Creation

Bartosz Łaniewski edited this page May 10, 2018 · 2 revisions
import {Exception} from "inra-server-error";

class CustomError extends Error implement Exception {
  errorCode = 1234;
  httpStatus = 500;
  userMessage = "Message for users";

  callback(error) {
    // …
  }
}

export default CustomError;

Note: when not using Flow, you cannot implement Exception – you can just omit it without any inconveniences.