Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does it support global custom error handler? #31

Open
caturbgs opened this issue Feb 11, 2025 · 0 comments
Open

Does it support global custom error handler? #31

caturbgs opened this issue Feb 11, 2025 · 0 comments

Comments

@caturbgs
Copy link

What is the type of issue?

Something else

What is the issue?

I'm just wanting to know, is this plugin support to custom error handler? My use case is I have custom error handler that transform http status code and response body based on its type of error.
My code is like this

export const app = new Elysia()
  // Hooks/Middlewares
  .use(loggerPlugin) // Using logger
  .use(corsPlugin)
  .use(jwtPlugin)
  .use(versionPlugin)
  // using custom error handler
  .use(errorPlugin) // Using custom error handler (for custom response)
  // Routes
  .use(
    await autoload({
      dir: join(process.cwd(), "src", "routes"),
    }),
  )
  .use(swaggerPlugin)
  // Cron
  // .use(cronJob) // Uncomment this line to enable cron job
  // GraphQL
  // .use(graphqlPlugin) // Uncomment this line to enable GraphQL
  // Start the server
  .listen(Bun.env.PORT ?? 3000);

Does it still capture the custom status code and message after error handling for the logger http?

Where did you find it?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant