-
Notifications
You must be signed in to change notification settings - Fork 0
ExceptionHandling
dannysmc95 edited this page Feb 24, 2022
·
1 revision
Exception handling in Turbo is pretty simple, it allows you to hook into an uncaught exception and do something with it and either exit or continue running.
To access the exception handler, in your Turbo configuration object you can do the following:
const onErrorHandler = async () => {
console.log('Do some async logic here...');
}
const engine = new Engine({
// ...
errors: {
handler: onErrorHandler,
continue: true,
},
// ...
});
The handler will be called when an uncaught exception is thrown, and the continue property will determine if the application will continue running or not, if continue is set to false, the application will attempt to shutdown normally, this is to allow services to still run their shutdown methods.
- Controllers
- Middleware
- Autowire
- Plugins
- Tasks
- Fibres
- Authentication
- Registry
- Services
- Dependecy Injection
- Translations (i18n)
- Safe Quit
- Exception Handling
- Event Listener
- Custom Logger
- HTTP Plugin - Built-In
- WS Plugin - Built-In
- Discord Plugin - External
- Vite Plugin - External
- Inspect Plugin - External
- CLI Plugin - External
- Got an issue? Join our Discord
- Need your own plugin? Contact Me
- Have an idea? Let's Discuss
- Want to support me? Buy me a coffee