Use logException consistently and use logDiagnostic

Many places around were re-inventing logException with varying level of success.
In addition, the full error is now printed as a diagnostic instead of debug.
This is more in line with the description of `LogLevel.diagnostic`
("Extended user information (e.g. for more detailed error information)"),
as opposed to the one of `LogLevel.debug_`
("Developer information useful for algorithm debugging").
This commit is contained in:
Geod24 2020-07-24 15:51:40 +09:00 committed by Mathias LANG
parent f3accb40d5
commit bd8c2c6e90
6 changed files with 14 additions and 24 deletions

View file

@ -102,9 +102,8 @@ int runApplication(string[]* args_out = null)
version (VibeDebugCatchAll) {
try {
status = runEventLoop();
} catch( Throwable th ){
logError("Unhandled exception in event loop: %s", th.msg);
logDiagnostic("Full exception: %s", th.toString().sanitize());
} catch (Throwable th) {
th.logException("Unhandled exception in event loop");
return 1;
}
} else {
@ -908,9 +907,7 @@ Timer setTimer(Duration timeout, void delegate() callback, bool periodic = false
return setTimer(timeout, () @trusted nothrow {
try callback();
catch (Exception e) {
logWarn("Timer callback failed: %s", e.msg);
scope (failure) assert(false);
logDebug("Full error: %s", e.toString().sanitize);
e.logException!(LogLevel.warn)("Timer callback failed");
}
}, periodic);
}