
Security News
Deno Goes the Way of the Dinosaur
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.
@eggjs/onerror
Advanced tools
Default error handling plugin for egg.
onerror plugin is enabled by default in egg. But you still can configure its properties to fits your scenarios.
errorPageUrl: String or Function - If user request html pages in production environment and unexpected error happened, it will redirect user to errorPageUrl.accepts: Function - detect user's request accept json or html.all: Function - customize error handler, if all present, negotiation will be ignored.html: Function - customize html error handler.text: Function - customize text error handler.json: Function - customize json error handler.js: Function - customize JSONP error handler.// config/config.default.ts
import { defineConfig } from 'egg';
export default defineConfig({
onerror: {
// errorPageUrl support function
errorPageUrl: (err, ctx) => ctx.errorPageUrl || '/500',
},
});
// an accept detect function that mark all request with `x-requested-with=XMLHttpRequest` header accepts json.
function accepts(ctx) {
if (ctx.get('x-requested-with') === 'XMLHttpRequest') return 'json';
return 'html';
}
Please open an issue here.
Made with contributors-img.
FAQs
error handler for egg
The npm package @eggjs/onerror receives a total of 278 weekly downloads. As such, @eggjs/onerror popularity was classified as not popular.
We found that @eggjs/onerror demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 10 open source maintainers collaborating on the project.

Security News
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.

Security News
Anthropic’s free OSS Scanner uses Mythos and other Claude models to find open source vulnerabilities and send maintainers reports with proposed fixes.

Security News
On Front Lines’ Early Adopters: CISO podcast, Andrew Becherer shares lessons from Datadog, weighs the long-term costs of AI-built tools, and explains how founders can actually gain a CISO’s trust.