Package akka.javasdk
Interface UnhandledExceptionHandler
public interface UnhandledExceptionHandler
Mix-in interface that can be implemented alongside
ServiceSetup on a class annotated with
Setup to be notified when the runtime catches an exception thrown by user code from a
component or endpoint.
Typical use is forwarding to an external error tracker.
The callback is invoked on the SDK dispatcher. It must not throw — any exception it throws is logged and swallowed.
Example:
@Setup
public class Bootstrap implements ServiceSetup, UnhandledExceptionHandler {
@Override
public void onUnhandledException(UnhandledExceptionContext context) {
Sentry.captureException(context.throwable());
}
}
-
Method Summary
Modifier and TypeMethodDescriptionvoidInvoked when the runtime catches an exception thrown by user code that was not turned into aCommandExceptionor a deliberate HTTP error response.
-
Method Details
-
onUnhandledException
Invoked when the runtime catches an exception thrown by user code that was not turned into aCommandExceptionor a deliberate HTTP error response.- Parameters:
context- the exception together with the correlation id surfaced to the client
-