Skip to content

Commit 290c207

Browse files
authored
task: Capture bridge message decoding failure details (#240)
There are infrequent fatal errors reported to the observability platform. The error reports contain very little details. This is an effort to uncover the origin of the failures.
1 parent 9958447 commit 290c207

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

ios/Sources/GutenbergKit/Sources/EditorViewController.swift

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,22 @@ public final class EditorViewController: UIViewController, GutenbergEditorContro
475475
delegate?.editor(self, didLogMessage: log.message, level: log.level)
476476
}
477477
} catch {
478-
fatalError("failed to decode message: \(error)")
478+
// Capture detailed diagnostic information for crash reporting
479+
let messageType = message.type
480+
let messageBodyDescription = String(describing: message.body)
481+
482+
let errorMessage = """
483+
Failed to decode editor message:
484+
- Message type: \(messageType)
485+
- Decode error: \(error)
486+
- Message body: \(messageBodyDescription)
487+
"""
488+
489+
NSLog("❌ GutenbergKit Message Decode Error: %@", errorMessage)
490+
491+
assertionFailure(errorMessage)
492+
493+
fatalError(errorMessage)
479494
}
480495
}
481496

0 commit comments

Comments
 (0)