Skip to content

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.

Features

Plugins

Future Plans

Resources

Clone this wiki locally