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

hapi-dev-errors

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-dev-errors - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

.eslintrc.json

5

CHANGELOG.md
# Changelog
## Version 1.3.1 (2017-10-17)
- `remove` editor config for code formatting (`.editorconfig` file)
- `add` eslint configuration via `.eslintrc.json`
- `add` required engine in `package.json`: `>=4.0.0`. This package required Node.js v4+ with release 1.0. This setting makes sure that NPM follows this dependency.
## Version 1.3.0 (2017-10-12)

@@ -4,0 +9,0 @@ - `add` handling of promise rejections, like `reply(Promise.reject(new Error('')))` (Thank you [Tafari](https://github.com/tafarij))

42

examples/default.js

@@ -15,25 +15,27 @@ 'use strict'

// register plugins to server instance
server.register([
{
register: require('../'),
options: {
showErrors: process.env.NODE_ENV !== 'production'
server
.register([
{
register: require('../'),
options: {
showErrors: process.env.NODE_ENV !== 'production'
}
}
}
]).then(() => {
])
.then(() => {
server.route({
method: 'GET',
path: '/',
handler: (request, reply) => {
reply.notAvailable()
}
})
server.route({
method: 'GET',
path: '/',
handler: (request, reply) => {
reply.notAvailable()
}
// start your server
server.start().then(() => {
console.log('Server running at: ' + server.info.uri)
})
})
// start your server
server.start().then(() => {
console.log('Server running at: ' + server.info.uri)
.catch((err) => {
throw err
})
}).catch(err => {
throw err
})

@@ -15,39 +15,41 @@ 'use strict'

// register plugins to server instance
server.register([
{
register: require('vision')
},
{
register: require('../'),
options: {
showErrors: process.env.NODE_ENV !== 'production',
template: 'error',
useYouch: true // this will be ignored, option 'template' > 'useYouch'
server
.register([
{
register: require('vision')
},
{
register: require('../'),
options: {
showErrors: process.env.NODE_ENV !== 'production',
template: 'error',
useYouch: true // this will be ignored, option 'template' > 'useYouch'
}
}
}
]).then(() => {
])
.then(() => {
server.views({
engines: {
html: require('handlebars')
},
path: __dirname + '/views',
layout: 'layout',
isCached: process.env.NODE_ENV !== 'production'
})
server.views({
engines: {
html: require('handlebars')
},
path: __dirname + '/views',
layout: 'layout',
isCached: process.env.NODE_ENV !== 'production'
})
server.route({
method: 'GET',
path: '/',
handler: (request, reply) => {
reply.notAvailable()
}
})
server.route({
method: 'GET',
path: '/',
handler: (request, reply) => {
reply.notAvailable()
}
// start your server
server.start().then(() => {
console.log('Server running at: ' + server.info.uri)
})
})
// start your server
server.start().then(() => {
console.log('Server running at: ' + server.info.uri)
.catch((err) => {
throw err
})
}).catch(err => {
throw err
})

@@ -15,26 +15,28 @@ 'use strict'

// register plugins to server instance
server.register([
{
register: require('../'),
options: {
showErrors: process.env.NODE_ENV !== 'production',
useYouch: true
server
.register([
{
register: require('../'),
options: {
showErrors: process.env.NODE_ENV !== 'production',
useYouch: true
}
}
}
]).then(() => {
])
.then(() => {
server.route({
method: 'GET',
path: '/',
handler: (request, reply) => {
reply.notAvailable()
}
})
server.route({
method: 'GET',
path: '/',
handler: (request, reply) => {
reply.notAvailable()
}
// start your server
server.start().then(() => {
console.log('Server running at: ' + server.info.uri)
})
})
// start your server
server.start().then(() => {
console.log('Server running at: ' + server.info.uri)
.catch((err) => {
throw err
})
}).catch(err => {
throw err
})

@@ -10,3 +10,2 @@ 'use strict'

exports.register = (server, options, next) => {
// default option values

@@ -38,8 +37,7 @@ const defaults = {

server.ext('onPreResponse', (request, reply) => {
// response shortcut
// response shortcut
const response = request.response
// only show `bad implementation` developer errors (status code 500)
if (response.isDeveloperError || (response.isBoom && response.output.statusCode === 500)) {
if (response.isBoom && response.output.statusCode === 500) {
const accept = request.raw.req.headers.accept

@@ -50,3 +48,3 @@ const statusCode = response.output.payload.statusCode

title: response.output.payload.error,
statusCode: statusCode,
statusCode,
message: response.message,

@@ -85,4 +83,4 @@ method: request.raw.req.method,

return youch.toHTML().then(response => {
return reply(response).code(statusCode)
return youch.toHTML().then((html) => {
return reply(html).code(statusCode)
})

@@ -93,3 +91,3 @@ }

const responseHtml = errorTemplate.replace(/%(\w+)%/g, (full, token) => {
return errorResponse[ token ] || ''
return errorResponse[token] || ''
})

@@ -96,0 +94,0 @@

{
"name": "hapi-dev-errors",
"description": "Return better error details and skip the look at command line to catch the issue.",
"version": "1.3.0",
"version": "1.3.1",
"author": "Future Studio <info@futurestud.io>",

@@ -16,6 +16,9 @@ "bugs": {

"code": "~4.1.0",
"hapi": "~16.4.3",
"lab": "~14.0.1",
"vision": "^4.1.1"
"hapi": "~16.6.2",
"lab": "~14.3.1",
"vision": "~4.1.1"
},
"engines": {
"node": ">=4.0.0"
},
"homepage": "https://github.com/fs-opensource/hapi-dev-errors#readme",

@@ -37,4 +40,4 @@ "keywords": [

"scripts": {
"test": "lab --assert code --leaks --coverage"
"test": "lab --assert code --leaks --coverage --lint"
}
}

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