Package net.carcdr.ycrdt
Class DefaultObserverErrorHandler
java.lang.Object
net.carcdr.ycrdt.DefaultObserverErrorHandler
- All Implemented Interfaces:
ObserverErrorHandler
Default implementation of
ObserverErrorHandler that prints errors to stderr.
This handler provides backwards-compatible behavior by printing exception messages and stack traces to the standard error stream.
For production applications, consider implementing a custom handler that integrates with your logging framework:
doc.setObserverErrorHandler((exception, source) -> {
logger.error("Observer error in {}: {}", source, exception.getMessage(), exception);
});
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DefaultObserverErrorHandlerSingleton instance of the default handler. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidhandleError(Exception exception, Object source) Handles an observer exception by printing to stderr.
-
Field Details
-
INSTANCE
Singleton instance of the default handler.
-
-
Constructor Details
-
DefaultObserverErrorHandler
public DefaultObserverErrorHandler()Creates a new DefaultObserverErrorHandler.
-
-
Method Details
-
handleError
Handles an observer exception by printing to stderr.- Specified by:
handleErrorin interfaceObserverErrorHandler- Parameters:
exception- the exception that was thrownsource- the object that dispatched the event
-