Release D 2.090.0
uranuz
neuranuz at gmail.com
Sun Mar 1 06:45:26 UTC 2020
I have just added workaround of this bug in by code. And now it
is working and returns backtrace
string[] getBacktrace(Throwable ex)
{
import std.conv: to;
import core.exception: OutOfMemoryError;
string[] backTrace;
try {
foreach( inf; ex.info )
backTrace ~= inf.to!string;
} catch( OutOfMemoryError exc ) {} // Workaround for some bug in
DefaultTraceInfo.opApply
return backTrace;
}
auto errorToJSON(Throwable ex)
{
import std.json: JSONValue;
return JSONValue([
"code": JSONValue(1),
"message": JSONValue(ex.msg),
"data": JSONValue([
"file": JSONValue(ex.file),
"line": JSONValue(ex.line),
"backtrace": JSONValue(getBacktrace(ex))
])
]);
}
More information about the Digitalmars-d-announce
mailing list