question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Logging non-fatal exceptions

See original GitHub issue

Sometimes there are exceptions that do/should not crash the applications. Would be great if there was the possibility of logging it with Crashlitics::logException.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
jaumardcommented, Sep 18, 2018

@jaggernod I’m doing the iOS side and in fact by using the API I notice that logError and logException are maybe not needed…

I just add a reportCrash() method to be able to support Zone reporting, so it mean that it will do same as logError and logException

So my idea is to remove those and just have an reportError (who can handle exception or error). What do you think ?

Basically now the main will look like this:

void main() {
  bool isInDebugMode = false;

  FlutterError.onError = (FlutterErrorDetails details) {
    if (isInDebugMode) {
      // In development mode simply print to console.
      FlutterError.dumpErrorToConsole(details);
    } else {
      // In production mode report to the application zone to report to
      // Crashlytics.
      Zone.current.handleUncaughtError(details.exception, details.stack);
    }
  };

  runZoned<Future<Null>>(() async {
    runApp(MyApp());
  }, onError: (error, stackTrace) async {
    // Whenever an error occurs, call the `reportCrash` function. This will send
    // Dart errors to our dev console or Crashlytics depending on the environment.
    await FlutterCrashlytics().reportCrash(error, stackTrace, forceCrash: false);
  });
}
0reactions
shyjuzzcommented, Mar 11, 2019

@jaumard Thank you for the reply. I couldnt see the non-fatal exception in the dashborad after 3 days as well and my project is working fine in the debug mode but gettiing the following exception in the release mode. Please help


`* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:dynamicProfileRuntimeClasspath'.
   > Could not resolve project :flutter_crashlytics.
     Required by:
         project :app
      > Could not select value from candidates [null, debug, release] using AlternateDisambiguationRule.BuildTypeRule.
         > java.lang.NullPointerException (no error message)`

I could fix it with

lintOptions {
        checkReleaseBuilds false
    }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Log Non-fatal errors on Crashlytics - android - Stack Overflow
I manage errors on my app and I want to log when specifics errors codes are returned. So, on Crashlytics I'd like the...
Read more >
Non-fatal errors vs fatal crashes: The differences explained
A non-fatal error is a failure in your application that didn't result in a crash for the user. In other words: the loss...
Read more >
Customize your Firebase Crashlytics crash reports - Google
Report non-fatal exceptions. In addition to automatically reporting your app's crashes, Crashlytics lets you record non-fatal exceptions and sends them to you ...
Read more >
Part 4: capturing non-fatal Android errors - Bugsnag
A non-fatal error might be an exception that is caught within a try-catch block, or a performance issue such as an ANR, which...
Read more >
Effective logging in Production with Firebase Crashlytics
When exceptions are logged manually in Firebase, they are logged as non-fatals. The best way to use non-fatals in your app is to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found