Flurry Crash Reporting

Has anyone managed to get flurry to correctly do crash reporting?

I have the following init

[lua]

flurry.init(flurryListener, { 

    apiKey = apiKey,

    crashReportingEnabled = true,

    logLevel = “all”

})

[/lua]

Using this just by itself does increase the issue count in flurry if I cause an error, but there are no details (stack or message).

If I add an “unhandledError” event listener I can send the handled error through to flurry and this will show up as a logged event, but it does not tie in with the crash analytics. And since it is now handled the issue could does not increase.

Basically, I can get the information into flurry but I can’t take advantage of the full range of crash analytics.

I have done some research and can see that the crash logs should show 3 different types of issues “Crashes, Caught Exceptions and Logged Errors”.  Not uncaught.  In other languages there is a method “logError” that you can use in the unHandledError function.

I was hoping that I could use the logEvent method in the same way, but have had no luck.  Any help would be appreciated.

Below is some of my attempts.

[lua]

local function myUnhandledErrorListener( event )

   table.print_r(event)

    local iHandledTheError = true

    if iHandledTheError then

        print( “Handling the unhandled error”, event.errorMessage )

        flurryListener(event)

        flurry.logEvent( “logError”,

        {

         message=event.errorMessage,

         exception=event.stackTrace

        })

        flurry.logEvent( “Application_UnhandledException”,

        {

         name=“uncaught”,

         reason=event.stackTrace

        })

        flurry.logEvent( “debug”,

        {

         name=“uncaught”,

         reason=event.stackTrace

        })

        flurry.logEvent( “Uncaught”,

        {

         name=“uncaught”,

         reason=event.stackTrace

        })

         flurry.logEvent( “Application_UnhandledException”, event)

   

        flurry.logEvent( “debug”, event)

      

        flurry.logEvent( “uncaught”, event)

      

    

    else

        print( “Not handling the unhandled error”, event.errorMessage )

    end

    

    return iHandledTheError

end

Runtime:addEventListener(“unhandledError”, myUnhandledErrorListener)

[/lua]

If you can hold on till next weekend I am building the following calls as a plugin. Not sure if this is what you are looking for. I currently have them in my native builds.

/\*! \* @brief Records an app exception. Commonly used to catch unhandled exceptions. \* @since 2.7 \* \* This method captures an exception for reporting to Flurry. We recommend adding an uncaught \* exception listener to capture any exceptions that occur during usage that is not \* anticipated by your app. \* \* @see #logError:message:error: for details on capturing errors. \* \* @code \* - (void) uncaughtExceptionHandler(NSException \*exception) { [Flurry logError:@"Uncaught" message:@"Crash!" exception:exception]; } - (void)applicationDidFinishLaunching:(UIApplication \*)application { NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler); [Flurry startSession:@"YOUR\_API\_KEY"]; // .... } \* @endcode \* \* @param errorID Name of the error. \* @param message The message to associate with the error. \* @param exception The exception object to report. \*/ + (void)logError:(nonnull NSString \*)errorID message:(nullable NSString \*)message exception:(nullable NSException \*)exception;

/\*! \* @brief Records an app error. \* @since 2.7 \* \* \* @see #logError:message:exception: for details on capturing exceptions. \* \* @code \* - (void) webView:(UIWebView \*)webView didFailLoadWithError:(NSError \*)error { [Flurry logError:@"WebView No Load" message:[error localizedDescription] error:error]; } \* @endcode \* \* @param errorID Name of the error. \* @param message The message to associate with the error. \* @param error The error object to report. \*/ + (void)logError:(nonnull NSString \*)errorID message:(nullable NSString \*)message error:(nullable NSError \*)error;

Awesome.   Count me in. 

Will this work alongside the regular flurry plugin so I can log standard events?

Cheers,

Craig

Hi agramonte, any update on this?

I have not started it yet but it is on the list, the day is long, and it is not something that will take me a long time. At most a couple of hours. Even if it slips off today’s list, it will be done by Monday. You’ll get a chance to use it this week after Corona approves it and uploades it.

I mean if I don’t run into some random problem with it (which is not very likely).

I was about to create the plugin and looking at the Android implementation of flurry those methods don’t exist on the Android side. flurry just captures any exception that is being thrown by Android. I don’t have time to look at this right now but it would be interesting to see what Corona does with a lua runtime error. If all they do is abort and don’t fire an exception then all you would get in flurry is the crash. 

I could only think of two ways around this and neither seems to be ideal.

  1. Add it to the corona source code so that it throws an exception with the details before aborting the runtime.

  2. Or create a plugin that throws a java exception that flurry can then capture. Using the exception handler in Corona to fire the plugin method to generate a java exception. 

Sorry, I can’t create a plugin. If the methods were available in Android it would have been easy. I still might do the Apple version in the coming days.

Cool.

Thanks for the effort. Back to the drawing board.

Craig