
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Common HTTP errors to be used with express.js or whatever engine you use.
Hata means "error" in Arabic (and Turkish!), which is where the package name comes from.
The following error types are currently supported:
BadRequestErrorUnauthorizedErrorForbiddenErrorNotFoundErrorConflictErrorUnprocessableEntityErrorThe error object is an instance of Error, with the properties name, message and stack.
var NotFoundError = require('hata/not-found');
throw new NotFoundError('Product not found');
You can also add more properties to the error object by passing them as the second parameter.
var NotFoundError = require('hata/not-found');
var error = new NotFoundError('Product not found', { item: 'product', id: 1, });
// error now has attributes `item` and `id`.
You can also use it in the following way:
var hata = require('hata');
var error = hata(404/*, message, obj*/);
Just add a regular error handler like the following:
// http://expressjs.com/guide/error-handling.html
app.use(function(err, req, res, next) { // jshint ignore:line
return res
.status(err.httpCode || 500)
.header('content-type: application/json')
.send(safeJsonStringify(err));
});
FAQs
Common HTTP errors to be used with express.js or whatever engine you use.
We found that hata demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.