Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
brahyam opened this issue May 14, 2024 · 0 comments
Open

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

brahyam opened this issue May 14, 2024 · 0 comments

Comments

@brahyam
Copy link

brahyam commented May 14, 2024

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant