Skip to content

Commit c061453

Browse files
lydellsupermario
authored andcommitted
Better msg name detection
1 parent 8dad19e commit c061453

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

extra/Lamdera/Injection.hs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,16 @@ injections mode isBackend isLocalDev =
479479
{
480480
if (buriedTimestamp !== null) {
481481
const elapsed = Date.now() - buriedTimestamp;
482-
bugsnag.notify(new Error('Got message ' + elapsed + ' ms after app was buried: ' + (msg.$ || '(unknown message)')));
482+
let msgName = '(unknown message)';
483+
if (msg.$) {
484+
msgName = msg.$;
485+
let current = msg;
486+
while (current.a && current.a.$ && !current.b) {
487+
current = current.a;
488+
msgName = msgName + ' ' + current.$;
489+
}
490+
}
491+
bugsnag.notify(new Error('Got message ' + elapsed + ' ms after app was buried: ' + msgName));
483492
return;
484493
}
485494

@@ -672,7 +681,16 @@ injections mode isBackend isLocalDev =
672681
{
673682
if (buriedTimestamp !== null) {
674683
const elapsed = Date.now() - buriedTimestamp;
675-
window.lamdera.bs.notify(new Error('Got message ' + elapsed + ' ms after app was buried: ' + (msg.$ || '(unknown message)')));
684+
let msgName = '(unknown message)';
685+
if (msg.$) {
686+
msgName = msg.$;
687+
let current = msg;
688+
while (current.a && current.a.$ && !current.b) {
689+
current = current.a;
690+
msgName = msgName + ' ' + current.$;
691+
}
692+
}
693+
window.lamdera.bs.notify(new Error('Got message ' + elapsed + ' ms after app was buried: ' + msgName));
676694
return;
677695
}
678696

0 commit comments

Comments
 (0)