Skip to content

'KotlinThrowable' is not convertible to 'any Error' #123

Open
@brahyam

Description

@brahyam

From the docs, for iOS is instructed to use to initialise release antilog:

#else
// Others(Release build)

// init firebase crashlytics
FirebaseApp.configure()

// init napier
NapierProxyKt.releaseBuild(antilog: CrashlyticsAntilog(
    crashlyticsAddLog: { priority, tag, message in
        Crashlytics.crashlytics().log("\(String(describing: tag)): \(String(describing: message))")
},
    crashlyticsSendLog: { throwable in
        Crashlytics.crashlytics().record(error: throwable) // <- ERROR HERE 'KotlinThrowable' is not convertible to 'any Error'
}))
#endif

However using the RELEASE code eg. archiving the app, throws the error: 'KotlinThrowable' is not convertible to 'any Error'

It is easily solvable by adding .asError() to the throwable but the documentation should be updated.

Recommended implementation should be:

#else
// Others(Release build)

// init firebase crashlytics
FirebaseApp.configure()

// init napier
NapierProxyKt.releaseBuild(antilog: CrashlyticsAntilog(
    crashlyticsAddLog: { priority, tag, message in
        Crashlytics.crashlytics().log("\(String(describing: tag)): \(String(describing: message))")
},
    crashlyticsSendLog: { throwable in
        Crashlytics.crashlytics().record(error: throwable.asError())
}))
#endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions