🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis
Socket
Book a DemoInstallSign in
Socket

easily-handle-error

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easily-handle-error

async function 을 사용한 에러 핸들이 가능합니다.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Build Status Npm Version

Based on project

https://www.npmjs.com/package/express-asyncify

Usage

npm install --save easily-handle-error
const express = require('express')
const ehe = require('ehe')
const app = ehe(express())
// Function
app.get('/error1', async (req, res) => {
  await timer()
  throw new Error('error')
})
// Function
app.get('/error2', async (req, res, next) => {
  await timer()
  next()
}, async (req, res) => {
  await timer()
  throw new Error('error')
})
// Array
app.get('/error3', [async (req, res, next) => {
  await timer()
  next()
}, async (req, res) => {
  await timer()
  throw new Error('error')
}])

app.use((err, req, res, next) => {
  if (err) res.status(500).end()
})

Example

init.test.js

Keywords

async

FAQs

Package last updated on 05 Feb 2018

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