exceptionHandler function
void
exceptionHandler({
- required String tag,
- required Exception exception,
- String? context = null,
- StackTrace? stacktrace = null,
Implementation
void exceptionHandler({required String tag, required Exception exception, String? context = null, StackTrace? stacktrace = null}) {
if (kDebugMode) {
throw exception;
} else {
final prefix = "[$tag]";
final ctx = context != null ? "[C:$context]" : "";
var logMessage = "THEOLogger$prefix$ctx - Exception happened: $exception";
if (!THEOLogger.instance.isListening()) {
logMessage += " - for more info, attach a logger to THEOLogger.instance!";
}
print(logMessage);
THEOLogger.instance._log(exception, stacktrace);
}
}