Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

koa-better-error-handler

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 3.0.4 to 3.0.5

.nyc_output/5fb48b36-29e6-4f3c-8897-1e46b275f845.json

2

.nyc_output/processinfo/index.json

@@ -1,1 +0,1 @@

{"processes":{"495548bc-8d40-465b-93de-13597d2add12":{"parent":null,"children":["d5defef9-50f5-4c56-93bb-dc9548a988a9"]},"d5defef9-50f5-4c56-93bb-dc9548a988a9":{"parent":"495548bc-8d40-465b-93de-13597d2add12","children":[]}},"files":{"/Users/jack/Projects/koa-better-error-handler/lib/index.js":["d5defef9-50f5-4c56-93bb-dc9548a988a9"]},"externalIds":{}}
{"processes":{"5fb48b36-29e6-4f3c-8897-1e46b275f845":{"parent":null,"children":["853d4f9a-6926-400c-9e21-510b3afeea74"]},"853d4f9a-6926-400c-9e21-510b3afeea74":{"parent":"5fb48b36-29e6-4f3c-8897-1e46b275f845","children":[]}},"files":{"/Users/jack/Projects/koa-better-error-handler/lib/index.js":["853d4f9a-6926-400c-9e21-510b3afeea74"]},"externalIds":{}}

@@ -11,3 +11,2 @@ const Koa = require('koa');

// override koa's undocumented error handler
// eslint-disable-next-line unicorn/prefer-add-event-listener
app.context.onerror = errorHandler;

@@ -14,0 +13,0 @@

@@ -41,3 +41,2 @@ const Koa = require('koa');

// override koa's undocumented error handler
// eslint-disable-next-line unicorn/prefer-add-event-listener
app.context.onerror = errorHandler;

@@ -44,0 +43,0 @@

@@ -98,3 +98,3 @@ "use strict";

this.status = this.statusCode;
this.body = new Boom(err.message, {
this.body = new Boom.Boom(err.message, {
statusCode: err.status

@@ -126,4 +126,4 @@ }).output.payload; // set any additional error headers specified

yield this.render('404');
} catch (err2) {
debug('could not find 404 page, using built-in 404 html');
} catch (err_) {
debug('could not find 404 page, using built-in 404 html', err_);
this.body = _404;

@@ -146,4 +146,4 @@ }

yield this.render('500');
} catch (err2) {
debug('could not find 500 page, using built-in 500 html');
} catch (err_) {
debug('could not find 500 page, using built-in 500 html', err_);
this.body = _500;

@@ -202,3 +202,3 @@ }

// translate messages
const translate = message => _.isFunction(ctx.request.t) ? ctx.request.t(message) : message; // passport-local-mongoose support
const translate = message => !err.no_translate && _.isFunction(ctx.request.t) ? ctx.request.t(message) : message; // passport-local-mongoose support

@@ -205,0 +205,0 @@

{
"name": "koa-better-error-handler",
"description": "A better error-handler for Lad and Koa. Makes `ctx.throw` awesome (best used with koa-404-handler)",
"version": "3.0.4",
"version": "3.0.5",
"author": "Nick Baugh <niftylettuce@gmail.com>",

@@ -16,5 +16,5 @@ "bugs": "https://github.com/ladjs/koa-better-error-handler/issues",

"dependencies": {
"@hapi/boom": "^7.4.3",
"@hapi/boom": "^9.0.0",
"camelcase": "^5.3.1",
"capitalize": "^2.0.0",
"capitalize": "^2.0.1",
"co": "^4.6.0",

@@ -28,16 +28,17 @@ "debug": "^4.1.1",

"devDependencies": {
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@commitlint/cli": "^8.1.0",
"@commitlint/config-conventional": "^8.1.0",
"ava": "^2.3.0",
"codecov": "^3.5.0",
"cross-env": "^5.2.1",
"eslint": "^6.3.0",
"@babel/cli": "^7.8.3",
"@babel/core": "^7.8.3",
"@babel/preset-env": "^7.8.3",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"@koa/router": "^8.0.6",
"ava": "2.x",
"codecov": "^3.6.2",
"cross-env": "6.x",
"eslint": "^6.8.0",
"eslint-config-xo-lass": "^1.0.3",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-node": "^11.0.0",
"fixpack": "^2.3.1",
"husky": "^3.0.5",
"koa": "^2.8.1",
"husky": "3.x",
"koa": "^2.11.0",
"koa-404-handler": "^0.0.2",

@@ -47,12 +48,11 @@ "koa-basic-auth": "^4.0.0",

"koa-convert": "^1.2.0",
"koa-generic-session": "^2.0.1",
"koa-redis": "^4.0.0",
"koa-router": "^7.4.0",
"lint-staged": "^9.2.5",
"nyc": "^14.1.1",
"koa-generic-session": "^2.0.4",
"koa-redis": "^4.0.1",
"lint-staged": "^10.0.4",
"nyc": "^15.0.0",
"redis": "^2.8.0",
"remark-cli": "^7.0.0",
"remark-cli": "^7.0.1",
"remark-preset-github": "^0.0.16",
"supertest": "^4.0.2",
"xo": "^0.24.0"
"xo": "^0.25.3"
},

@@ -59,0 +59,0 @@ "engines": {

@@ -63,3 +63,2 @@ # koa-better-error-handler

// override koa's undocumented error handler
// eslint-disable-next-line unicorn/prefer-add-event-listener
app.context.onerror = errorHandler;

@@ -132,3 +131,2 @@

// override koa's undocumented error handler
// eslint-disable-next-line unicorn/prefer-add-event-listener
app.context.onerror = errorHandler;

@@ -174,2 +172,15 @@

## Prevent Errors From Being Automatically Translated
As of v3.0.5, you can prevent an error from being automatically translated by setting the error property of `no_translate` to have a value of `true`:
```js
function middleware(ctx) {
const err = Boom.badRequest('Uh oh!');
err.no_translate = true; // <----
ctx.throw(err);
}
```
## HTML Error Lists

@@ -176,0 +187,0 @@

const http = require('http');
const test = require('ava');
const Router = require('koa-router');
const Router = require('@koa/router');
const request = require('supertest');

@@ -10,3 +10,3 @@ const Koa = require('koa');

const errorHandler = require('../lib');
const errorHandler = require('..');

@@ -29,3 +29,2 @@ const statusCodes = _.keys(http.STATUS_CODES)

// override koa's undocumented error handler
// eslint-disable-next-line unicorn/prefer-add-event-listener
t.context.app.context.onerror = errorHandler;

@@ -32,0 +31,0 @@

Sorry, the diff of this file is not supported yet

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