bugsnag-cocoa icon indicating copy to clipboard operation
bugsnag-cocoa copied to clipboard

fatalError message not captured by BugSnag

Open 0xpablo opened this issue 7 months ago • 3 comments

Describe the bug

Hi there, we are in the process of evaluating BugSnag to switch from Crashlytics. We use GRDB and sometimes have fatalConversionError crashes. This crash happens when there is an attempt to read a value from a missing column for instance. I noticed that Crashlytics populates a crash_info_entry_0 key with data such as this:

/Users/distiller/Library/Developer/Xcode/DerivedData/xxx-gkoktxxwoccurtcsovqddkqarggu/SourcePackages/checkouts/GRDB.swift/GRDB/Core/DatabaseValueConversion.swift:160: Fatal error: could not read Bool from missing column `feature_enabled` (row: [id:"xxx" parent_folder_id:"yyy" lww_parent_folder_id:Data(48 bytes) root_folder_id:"zzz" item_id:"..., sql: `SELECT folder_to_folder_items.*, CASE documents.document_type WHEN 0 THEN pages.thumbnail_tag WHEN 1 THEN problems.thumbnail_tag

I checked GRDB's source and it's using a fatalError with a dynamic message:

func fatalConversionError<T>(
    to: T.Type,
    from dbValue: DatabaseValue?,
    conversionContext: ValueConversionContext?,
    file: StaticString = #file,
    line: UInt = #line)
    -> Never
{
    fatalError(
        conversionErrorMessage(
            to: T.self,
            from: dbValue,
            conversionContext: conversionContext),
        file: file,
        line: line)
}

We can't see the error message in BugSnag

image image

I noticed there was this old PR fixing fatalError reporting https://github.com/bugsnag/bugsnag-cocoa/pull/948 and https://github.com/bugsnag/bugsnag-cocoa/pull/1010 I'm wondering if something's changed in the swift runtime that might have broken this.

Environment

  • Bugsnag version: v6.29.0
  • iOS/tvOS/macOS version(s): iOS 17.5.1
  • Simulator or physical device: Physical device
  • Xcode version: Xcode 15.4
  • Swift version: 5.10

0xpablo avatar Jul 16 '24 09:07 0xpablo