Skip to main content
Version: 57.2.0

passthroughOrWrap

passthroughOrWrap(error, wrapper): APIError

Picks the error to throw for something caught in a hook, transformer, or Mongoose middleware. An APIError is passed through untouched so its status, code, detail, and meta reach the client; anything else is wrapped in the given framework error. wrapper may override any field, including detail, which defaults to the caught error's text.

Parameters

error

unknown

wrapper

APIErrorOptions

Returns

APIError