Function errorFromCode

  • Create the correct error object from a status code

    Parameters

    • code: number

      Will be converted to respective error (ex. 404 -> NotFoundError)

    • Optionalmessage: string

      Override default error message

    Returns CustomError

    The proper error type