Merge pull request #24 from vibe-d/error_handling
Use abort() in case of uncaught Error exceptions. merged-on-behalf-of: Sönke Ludwig <s-ludwig@users.noreply.github.com>
This commit is contained in:
commit
c62f07d257
|
@ -416,13 +416,13 @@ final package class TaskFiber : Fiber {
|
||||||
logDiagnostic("Full error: %s", th.toString().sanitize());
|
logDiagnostic("Full error: %s", th.toString().sanitize());
|
||||||
} catch (Throwable th) {
|
} catch (Throwable th) {
|
||||||
import std.stdio : stderr, writeln;
|
import std.stdio : stderr, writeln;
|
||||||
import core.stdc.stdlib : exit;
|
import core.stdc.stdlib : abort;
|
||||||
try stderr.writeln(th);
|
try stderr.writeln(th);
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
try stderr.writeln(th.msg);
|
try stderr.writeln(th.msg);
|
||||||
catch (Exception e) {}
|
catch (Exception e) {}
|
||||||
}
|
}
|
||||||
exit(1);
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -237,7 +237,7 @@ private class WorkerThread : Thread {
|
||||||
|
|
||||||
private void main()
|
private void main()
|
||||||
nothrow {
|
nothrow {
|
||||||
import core.stdc.stdlib : exit;
|
import core.stdc.stdlib : abort;
|
||||||
import core.exception : InvalidMemoryOperationError;
|
import core.exception : InvalidMemoryOperationError;
|
||||||
import std.encoding : sanitize;
|
import std.encoding : sanitize;
|
||||||
|
|
||||||
|
@ -249,19 +249,13 @@ private class WorkerThread : Thread {
|
||||||
if (!m_pool.m_state.lock.term) runEventLoop();
|
if (!m_pool.m_state.lock.term) runEventLoop();
|
||||||
logDebug("Worker thread exit.");
|
logDebug("Worker thread exit.");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
scope (failure) exit(-1);
|
scope (failure) abort();
|
||||||
logFatal("Worker thread terminated due to uncaught exception: %s", e.msg);
|
logFatal("Worker thread terminated due to uncaught exception: %s", e.msg);
|
||||||
logDebug("Full error: %s", e.toString().sanitize());
|
logDebug("Full error: %s", e.toString().sanitize());
|
||||||
} catch (InvalidMemoryOperationError e) {
|
|
||||||
import std.stdio;
|
|
||||||
scope(failure) assert(false);
|
|
||||||
writeln("Error message: ", e.msg);
|
|
||||||
writeln("Full error: ", e.toString().sanitize());
|
|
||||||
exit(-1);
|
|
||||||
} catch (Throwable th) {
|
} catch (Throwable th) {
|
||||||
logFatal("Worker thread terminated due to uncaught error: %s", th.msg);
|
logFatal("Worker thread terminated due to uncaught error: %s", th.msg);
|
||||||
logDebug("Full error: %s", th.toString().sanitize());
|
logDebug("Full error: %s", th.toString().sanitize());
|
||||||
exit(-1);
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue