New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

koa-2-error-handler

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-2-error-handler - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

22

index.js

@@ -1,19 +0,3 @@

const debug = require('debug')('error:handler');
const httpStatus = require('http-status-codes');
exports.error = callback => async (ctx, next) => {
try {
await next();
return ctx.response.status === httpStatus.NOT_FOUND ? ctx.throw(httpStatus.NOT_FOUND) : true;
} catch (err) {
debug(err);
ctx.status = err.statusCode || err.status || httpStatus.INTERNAL_SERVER_ERROR;
if (callback) {
callback(err, ctx);
} else {
ctx.body = {
message: err.message
};
}
}
};
exports.error = require('./lib/error');
exports.helper = require('./lib/helper');
exports.server = require('./lib/server');

15

package.json
{
"name": "koa-2-error-handler",
"description": "Error reponses for koa 2",
"description": "Error handler for Koa 2 application.",
"repository": "evheniy/koa-2-error-handler",
"version": "0.0.1",
"version": "0.0.2",
"scripts": {
"start": "node --harmony ./bin/www",
"test": "npm run security && npm run clear && npm run lint && npm run coverage",
"lint": "./node_modules/.bin/eslint index.js tests",
"lint": "./node_modules/.bin/eslint index.js tests lib",
"coverage": "node --harmony ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- tests --recursive",
"report-coverage": "cat ./coverage/lcov.info | ./node_modules/.bin/coveralls",
"clear": "./node_modules/.bin/rimraf coverage",

@@ -27,5 +28,3 @@ "security": "./node_modules/.bin/nsp check"

"dependencies": {
"http-status-codes": "^1.1.6",
"koa": "^2.0.0-alpha.7",
"koa-router": "^7.0.1"
"http-status-codes": "^1.1.6"
},

@@ -35,6 +34,10 @@ "devDependencies": {

"chai-http": "^3.0.0",
"coveralls": "^2.11.15",
"debug": "^2.6.0",
"eslint": "^3.14.1",
"istanbul": "^1.1.0-alpha.1",
"koa": "^2.0.0-alpha.7",
"koa-router": "^7.0.1",
"mocha": "^3.2.0",
"mocha-lcov-reporter": "^1.2.0",
"nsp": "^2.6.2",

@@ -41,0 +44,0 @@ "rimraf": "^2.5.4",

@@ -6,2 +6,3 @@ Koa.js 2 error handler

[![Build Status](https://travis-ci.org/evheniy/koa-2-error-handler.svg?branch=master)](https://travis-ci.org/evheniy/koa-2-error-handler)
[![Coverage Status](https://coveralls.io/repos/github/evheniy/koa-2-error-handler/badge.svg?branch=master)](https://coveralls.io/github/evheniy/koa-2-error-handler?branch=master)

@@ -12,3 +13,3 @@

Error response middleware for koa 2 supporting.
Error handler for Koa 2 application.

@@ -15,0 +16,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc