Errors
ceramic.Errors (Class)
Global error handling utilities for the Ceramic engine.
This class provides centralized error handling for uncaught exceptions, ensuring proper error reporting, stack trace capture, and graceful application shutdown when critical errors occur.
Features
- Stack Trace Capture: Automatically captures and formats stack traces
- Custom Error Handlers: Apps can listen for critical errors
- Cross-platform Output: Adapts output method to platform capabilities
- Graceful Shutdown: Exits cleanly on system targets
Error Flow
- Uncaught exception occurs
- Stack trace is captured and reversed
- App's criticalError event is emitted
- Stack trace and error are printed
- Application exits (if no custom handler)
Usage Example
// Listen for critical errors in your app
app.onCriticalError(this, (error, stack) -> {
// Log to crash reporting service
crashReporter.logError(error, stack);
// Show user-friendly error dialog
showErrorDialog("An error occurred: " + error);
});
See: ceramic.App#onCriticalError For handling errors in your app, ceramic.Utils#stackItemToString For stack trace formatting
Private Members
Handles uncaught errors by capturing stack traces and notifying the app.
This method is called internally by the engine when an uncaught exception occurs. It performs the following steps:
- Checks if app has custom error handlers
- Captures and reverses the exception stack trace
- Emits criticalError event on the app
- Prints formatted stack trace to console/output
- Exits application if no custom handler exists
Name | Type | Description |
---|---|---|
e |
Dynamic | The uncaught error/exception object |