
Product
Introducing Supply Chain Attack Campaigns Tracking in the Socket Dashboard
Campaign-level threat intelligence in Socket now shows when active supply chain attacks affect your repositories and packages.
@map-colonies/error-express-handler
Advanced tools
This package exports a middleware for express that handles Error and HttpError(custom package type).
npm install --save @map-colonies/error-express-handler
Check the autogenerated documentation here.
Add the handler as the last middleware, so any error forwarded by the controllers will be handled.
If the value of NODE_ENV is production the error message will be redacted and a generic one will be sent instead.
In development, in addition to the error message, the stack trace of the error will be included in the response.
import express from 'express';
import { getErrorHandlerMiddleware } from '@map-colonies/error-express-handler';
process.env.NODE_ENV = 'development';
const app = express();
app.use('/meow', fn);
app.use(getErrorHandlerMiddleware());
app.listen(8080, function() {
console.log('server is up');
});
flowchart TD
A@{ label: "NODE_ENV='production'" } -- true --> B["error implements HttpError"]
A -- false --> C["error implements HttpError"]
B -- true --> D["Status code: err.StatusCode<br>body: {fl°°34¶ßmessagefl°°34¶ß:fl°°34¶ßerr.messagefl°°34¶ß}"]
B -- false --> E["Status code: 500<br>body: {fl°°34¶ßmessagefl°°34¶ß:fl°°34¶ßInternal Server Errorfl°°34¶ß}"]
C -- true --> F["Status code: err.StatusCode<br>body: {fl°°34¶ßmessagefl°°34¶ß:fl°°34¶ßerr.messagefl°°34¶ß}"]
C -- false --> G["Status code: 500<br>body: {fl°°34¶ßmessagefl°°34¶ß:fl°°34¶ßInternal Server Errorfl°°34¶ß, fl°°34stacktracefl°°34:err.stack }"]
FAQs
Express error handler for the MapColonies project
The npm package @map-colonies/error-express-handler receives a total of 354 weekly downloads. As such, @map-colonies/error-express-handler popularity was classified as not popular.
We found that @map-colonies/error-express-handler demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 11 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.

Product
Campaign-level threat intelligence in Socket now shows when active supply chain attacks affect your repositories and packages.

Research
Malicious PyPI package sympy-dev targets SymPy users, a Python symbolic math library with 85 million monthly downloads.

Security News
Node.js 25.4.0 makes require(esm) stable, formalizing CommonJS and ESM compatibility across supported Node versions.