Skip to main content

UncaughtException

Client-side function

JavaScript​

Parameters​

  • exception: Unhandled exception, it is of any type.

Example​

The example below cancels the default error message box on client unhandled exception/error and prints to the F11 console instead.

mp.events.add("uncaughtException", (exception) => {
// Print the message to F11 console or do whatever you need with it
mp.console.logError(`[uncaughtException]: ${exception}`);

// Cancel the event to prevent default error message box
return true;
});