
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
errman is an error helper that lets you:
npm install errman
component install errman
var errman = require('errman');
// Create a type with no message template and status code of 500.
var BadMojoError = errman.type('BadMojoError');
// You can pass a string to your custom error constructor to just set the error
// message old school.
throw new BadMojoError('No way, dude!');
var errman = require('errman');
// Use mustache template for error message, and set status code to 404.
var FileNotFoundError = errman.type('FileNotFoundError', {
message: 'Could not find file: {{filePath}}',
status: 404
});
try {
throw new FileNotFoundError({filePath: '/some/file/path.txt'});
} catch (e) {
console.log(e.message);
}
The error message printed to the console will be:
Could not find file: /some/file/path.txt
var errman = require('errman');
errman.registerType('BadMojoError');
errman.registerType('FileNotFoundError', {
message: 'Could not find file: {{filePath}}',
status: 404
});
// Registered errors are available on the errman module.
throw new errman.BadMojoError;
throw new errman.FileNotFoundError({filePath: '/some/file/path.txt'});
var errman = require('errman');
errman.registerType('BadMojoError');
var myErrMan = errman();
myErrMan.registerType('FileNotFoundError', {
message: 'Could not find file: {{filePath}}',
status: 404
});
throw new errman.BadMojoError;
throw new myErrMan.FileNotFoundError({filePath: '/some/file/path.txt'});
// This won't work:
throw new myErrMan.BadMojoError;
// Neither will this:
throw new errMan.FileNotFoundError({filePath: '/some/file/path.txt'});
var errman = require('errman');
errman.registerType('FileNotFoundError', {
message: 'Could not find file: {{filePath}}',
status: 404,
code: 'file_not_found'
});
try {
throw new FileNotFoundError({filePath: '/some/file/path.txt'});
} catch (e) {
console.log(e.toJSON());
}
The JSON will be:
{
"name": "FileNotFoundError",
"status": 404,
"code": "file_not_found",
"message": "Could not find file: /some/file/path.txt"
"detail": {
"filePath": "/some/file/path.txt"
}
}
If you want to provide the stacktrace in the JSON, do this:
console.log(e.toJSON(true));
The simplest way to deserialize an error is:
var err = errman.toError({
"name": "FileNotFoundError",
"status": 404,
"code": "file_not_found",
"message": "Could not find file: /some/file/path.txt"
"detail": {
"filePath": "/some/file/path.txt"
}
});
assert(err instanceof errman.FileNotFoundError); // true
This may be fine in some cases. However, note that in the example above, the stacktrace was not in the JSON, so the stack will be reported as some place in the errman source, where the error is created. If you want the stacktrace to be where you deserialize the error, then you'll need to do this:
var err = new errman.Error({
"name": "FileNotFoundError",
"status": 404,
"code": "file_not_found",
"message": "Could not find file: /some/file/path.txt"
"detail": {
"filePath": "/some/file/path.txt"
}
});
assert(err instanceof errman.FileNotFoundError); // false
This leverages the default Error constructor available on all errman instances. However, note that the error is (of course) not of the specific type. You can combine these together though like this:
var err = errman.toError(new errman.Error({
"name": "FileNotFoundError",
"status": 404,
"code": "file_not_found",
"message": "Could not find file: /some/file/path.txt"
"detail": {
"filePath": "/some/file/path.txt"
}
}));
assert(err instanceof errman.FileNotFoundError); // true
This creates an error with the appropriate stacktrace and then converts it into a specifically typed error. You can also use some method sugar:
var err = new errman.Error({
"name": "FileNotFoundError",
"status": 404,
"code": "file_not_found",
"message": "Could not find file: /some/file/path.txt"
"detail": {
"filePath": "/some/file/path.txt"
}
}).typed();
assert(err instanceof errman.FileNotFoundError); // true
FAQs
Error types/helpers
We found that errman demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.