
Product
Introducing Reports: An Extensible Reporting Framework for Socket Data
Explore exportable charts for vulnerabilities, dependencies, and usage with Reports, Socket’s new extensible reporting framework.
@expresso/errors
Advanced tools
Error middleware for expresso
The error middleware will receive all errors from @expresso/app (and every other error thrown inside any routes) and it is going to sanitize it to a default response pattern with message, code and stack informations. It'll also catch any unknown error messages and parse them as HTTP 500 errors.
Install it:
$ npm i @expresso/errors
Import and use it:
import route from './route'
import expresso, { IExpressoConfigOptions } from '@expresso/app'
import server from '@expresso/server'
import errors from '@expresso/errors'
interface IAppConfig extends IAuthConfig, IExpressoConfigOptions {}
const appFactory = expresso((app, config: IAppConfig, environment) => {
app.get('/', route)
app.use(errors(environment))
})
const options = {
name: 'myApp',
jwt: {
algorithms: ['HS256'],
audience: 'your-audience',
issuer: 'your-issuer',
secret: 'shhhhh'
}
}
server.start(appFactory, options)
The error middleware receives a string declaring the current environment for your application. If this environment is different from production, then all the error stack will also be displayed.
If you'd like to include more data in the error, pass on a boom error with { additionalData: yourData } as second parameter.
Example:
if (err instanceof ExternalAPIError) return next(boom.serverUnavailable(err.message, { additionalProperties: err.data }))
This will render the added data to the response
FAQs
@expresso express error handling suite
We found that @expresso/errors 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.

Product
Explore exportable charts for vulnerabilities, dependencies, and usage with Reports, Socket’s new extensible reporting framework.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.