New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@maeum/error-handler

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@maeum/error-handler

maeum boilerplate error handler creator

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
4
-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

@maeum/error-handler

ts Download Status Github Star Github Issues NPM version License ci code style: prettier

Error hander extension of the Maeum boilerplate.

Table of Contents

Getting Start

npm i @maeum/error-handler --save

How it works?

@maeum/error-handler create error handler for fastify.setErrorHandler function.

server.setErrorHandler(
  errorHandler([], {
  [CE_MAEUM_DEFAULT_ERROR_HANDLER.COMMON]: (req, id, param) => getLocales(req.headers['accept-language']).t(id, param),
  [CE_MAEUM_DEFAULT_ERROR_HANDLER.DEFAULT_REST_ERROR]: (req, id, param) => getLocales(req.headers['accept-language']).t(id, param),
}, {
    hooks: {
      [CE_MAEUM_DEFAULT_ERROR_HANDLER.COMMON]: {
        pre: (err: Error & { validation?: ErrorObject[] }, req: FastifyRequest) => {
          req.setRequestError(err);
        },
      },
    },
    encryptor: (code: string): string => {
      if (
        config.server.runMode === CE_RUN_MODE.STAGE ||
        config.server.runMode === CE_RUN_MODE.PRODUCTION
      ) {
        return encrypt(code);
      }

      return code;
    },
  }),
);

FAQs

Package last updated on 17 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts