Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
hapi-dev-errors
Advanced tools
Return better error details and skip the look at command line to catch the issue.
A hapi plugin to return an error view for web requests, providing more details of the issue. Also, provides the error stacktrace within the browser and you can skip the extra look at your command line to catch the issue.
The plugin is written in ES2015, please use Node.js v4 or later.
Add hapi-dev-errors
as a dependency to your project:
npm i -S hapi-dev-errors
# you’re using NPM shortcuts to (i)nstall and (-S)ave the module as a dependency
# NPM v5 users, please this way
npm i hapi-dev-errors
hapi-dev-errors
is disabled by default to avoid leaking sensitive error details during production.
Enable the plugin by define a "truthy" value for the showErrors
option.
The most straight forward way to register the hapi-dev-errors
plugin:
server.register({
register: require('hapi-dev-errors'),
options: {
showErrors: process.env.NODE_ENV !== 'production'
}
}, err => {
if (err) {
// handle plugin registration error
}
// went smooth like chocolate :)
})
The following plugin options allow you to customize the default behavior of hapi-dev-errors
:
(boolean)
, default: false
— by default, the plugin is disabled and keeps hapi's default error handling behavior(string)
, no default — provide the template name that you want to render with reply.view(template, errorData)
server.register({
register: require('hapi-dev-errors'),
options: {
showErrors: process.env.NODE_ENV !== 'production',
template: 'my-error-view'
}
}, err => {
if (err) {
// handle plugin registration error
}
// do the heavy lifting :)
})
hapi-dev-errors
supports the template
option while registering the plugin. Provide a template name to
use your personal error template and not the default one shipped with hapi-dev-errors
. In case you pass a string
value for the template name, the view will be rendered with reply.view(template, errorData).code(500)
.
Available properties to use in your custom error view:
title
: error title like Internal Server Error
statusCode
: HTTP response status code (always 500)message
: error message, like Uncaught error: reply.view(...).test is not a function
method
: HTTP request method, like GET
url
: URL request path, like /signup
headers
: HTTP request headers object, in key-value formatGET
payload
: HTTP request payload, only available for HTTP methods other than GET
, in key-value formatstacktrace
: error stacktraceDo you miss a feature? Please don’t hesitate to create an issue with a short description of your desired addition to this plugin.
git checkout -b my-feature
git commit -am 'Add some feature'
git push origin my-new-feature
MIT © Future Studio
futurestud.io · GitHub @fs-opensource · Twitter @futurestud_io
Version 1.0.0 (2017-06-14)
add
option showErrors
to enable plugin by a boolean value or expressionadd
option template
to render custom view templatesprovide
README to document currently available plugin featuresFAQs
Return better error details and skip the look at command line to catch the issue.
The npm package hapi-dev-errors receives a total of 782 weekly downloads. As such, hapi-dev-errors popularity was classified as not popular.
We found that hapi-dev-errors demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
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.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.