How to use strong-error-handler - 1 common examples

To help you get started, we’ve selected a few strong-error-handler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strongloop / loopback-next / packages / rest / src / actions / reject.action.ts View on Github external
reject(
    @inject(RestBindings.Http.CONTEXT) {request, response}: HandlerContext,
    error: Error,
  ) {
    const err = error as HttpError;
    if (!err.status && !err.statusCode && err.code) {
      const customStatus = codeToStatusCodeMap[err.code];
      if (customStatus) {
        err.statusCode = customStatus;
      }
    }
    const statusCode = err.statusCode || err.status || 500;
    writeErrorToResponse(err, request, response, this.errorWriterOptions);
    this.logError(err, statusCode, request);
  }

strong-error-handler

Error handler for use in development and production environments.

MIT
Latest version published 1 month ago

Package Health Score

81 / 100
Full package analysis

Popular strong-error-handler functions

Similar packages