in sdk/src/Core/Internal/Emitters/JsonSegmentMarshaller.cs [211:247]
private static void CauseExporter(Cause cause, JsonWriter writer)
{
// Propagating faults (e.g. exceptions) can refer to the local root cause exception with its ID rather than duplicating the exceptions.
// format -> "cause" : "4fe5fbae3f9e29c1"
if (cause.IsExceptionAdded)
{
var firstException = cause.ExceptionDescriptors[0];
if (firstException.Cause != null && firstException.Id == null)
{
writer.Write(firstException.Cause);
return;
}
}
writer.WriteObjectStart();
if (cause.WorkingDirectory != null)
{
writer.WritePropertyName("working_directory");
writer.Write(cause.WorkingDirectory);
}
if (cause.Paths != null)
{
writer.WritePropertyName("paths");
JsonMapper.ToJson(cause.Paths, writer);
}
if (cause.IsExceptionAdded)
{
writer.WritePropertyName("exceptions");
JsonMapper.ToJson(cause.ExceptionDescriptors, writer);
}
writer.WriteObjectEnd();
}