in github-label-notifier/symbolizer/lib/bot.dart [384:440]
void mailFailures(
RepositorySlug repo,
Issue issue,
Map<int, _Comment> comments,
Map<int, SymbolizationResult> symbolized) async {
if (failuresEmail == null) {
return;
}
final failures = symbolized.onlyFailures;
if (failures.isEmpty) {
return;
}
final escape = const HtmlEscape().convert;
final buf = StringBuffer();
buf.write('''<p>Hello 👋</p>
<p>I was asked to symbolize crashes from <a href="${issue.htmlUrl}">issue ${issue.number}</a>, but failed.</p>
''');
for (var entry in failures.entries) {
entry.value.when(ok: (results) {
for (var result in results) {
buf.writeln('''
<p>When processing <a href="${comments[entry.key].url}">comment</a>, I found crash</p>
<pre>${escape(result.crash.toString())}</pre>
<p>but failed with the following notes:</p>
''');
for (var note in result.notes) {
buf.writeln(
'${noteMessage[note.kind]} <pre>${escape(note.message ?? '')}');
}
}
}, error: (note) {
buf.writeln('''
<p>When processing <a href="${comments[entry.key].url}">comment</a>, I failed with the following error:</p>
''');
buf.writeln(
'${noteMessage[note.kind]} <pre>${escape(note.message ?? '')}');
});
}
if (dryRun) {
print(buf);
} else {
await mailer.send(
Email(
[
Personalization([Address(failuresEmail)])
],
Address('noreply@dart.dev'),
'symbolization errors for issue #${issue.number}',
content: [Content('text/html', buf.toString())],
),
);
}
}