Hi,
We’re in the process of adding https://scotth.tech/plugin-fabric to our apps and are have 3 problems that we could use some help with. They could all be related, don’t know
1) Google (GP console) is still getting the error “logged” on Crash and ARN dashboard.
Looks like the error are bleeding through, not suppressing them in the first place which is consistent with our crash (see #3 below)
2) We’re not seeing the Crashlytics dashboard we logging into the web
We don’t understand why, our account was created and the plugin paid for. The fact that google is also logging error tells us we’re not doing something right either.
So if we login, and then try to go to we are redirected to https://fabric.io/kits/ios/crashlytics/install which means I either didn’t log any bugs (and we have) or there’s something we don’t understand we need to do (account registration/setup).
3) This doesn’t always work Runtime:addEventListener(“unhandledError”, firerabbitErrorHandler)
We believe this has nothing to do with plugin its self but even when we “return true” in the our listener firerabbitErrorHandler, our app crash on device 50% of the time. One thought is that we’re maybe crashing in our error handler. Other other is that are many, many plugs might somehow over-write this handler (is that even possible? how can we check). Anyways, here’s the code:
mainLibrary.useFirebaseCrashlytics = true -- Firebase Crashlytics... if( mainLibrary.useFirebaseCrashlytics ) then fabric = require "plugin.fabric" fabric.init(true) end -- Function for recording a Crashlytics error... function recordError( stringErrorMessage, numberErrorCode ) printToConsole( "\n\nrecordError: Request received to log error!" ) -- Validation... if( stringErrorMessage == nil or numberErrorCode == nil ) then -- Missing one of the parameters! printToConsole( "recordError: FAIL. stringErrorMessage or numberErrorCode was nil: " .. tostring(stringErrorMessage) .. ", " .. tostring(numberErrorCode) ) return false elseif( type(numberErrorCode) ~= "number" ) then -- Was not a number provided! printToConsole( "recordError: FAIL. numberErrorCode must be number! Was given: " .. tostring(numberErrorCode) ) return false end if( mainLibrary.useFirebaseCrashlytics and fabric ~= nil and mainLibrary.specialText ~= nil and mainLibrary.specialText.text ~= nil and system.getInfo( "environment" ) ~= "simulator" ) then -- Add the current log text to the error report, might be handy? fabric.addLog( "LOG: " .. tostring(mainLibrary.specialText.text) ) end -- Okay, let's report the error. No matter what we need to report to console first. printToConsole( "recordError: ERROR NUMBER: " .. tostring(numberErrorCode) ) printToConsole( "recordError: ERROR DESCRIPTION: \n\n" .. tostring(stringErrorMessage) ) -- Send to Crashlytics if enabled... if( mainLibrary.useFirebaseCrashlytics ) then -- Is it initialized? if( fabric == nil ) then -- Not initialized! printToConsole( "recordError: WARNING. Crashlytics is enabled but not initialized! Could not send!" ) elseif( system.getInfo( "environment" ) == "simulator" ) then -- Simulator! printToConsole( "recordError: Not sending to Crashlytics because it doesn't work on Simulator!" ) else -- Send it! printToConsole( "recordError: Transmitting error to Crashlytics now!" ) fabric.recordError(stringErrorMessage, numberErrorCode) end else printToConsole( "recordError: Not sending to Crashlytics because mainLibrary.useFirebaseCrashlytics == FALSE!" ) end -- This was success... return true end -- Error handling override... function firerabbitErrorHandler( event ) -- An unhandled error has occurred! \*\*\*\*! printToConsole( "UNHANDLED ERROR: \*\*\*\*! Unhandled runtime error occurred!" ) -- Validate 'event'.. it should have 'errorMessage' and 'stackTrace' to play with, then log the error... if( event == nil ) then printToConsole( " ... WARNING: 'event' that was passed to handler was nil!" ) recordError( "UNKNOWN UNHANDLED ERROR, no event was passed!", 666) -- recordError takes error description (string), and error code (number)... elseif( event.errorMessage == nil or event.stackTrace == nil) then printToConsole( " ... WARNING: 'event.errorMessage' or 'event.stackTrace' was nil!" ) recordError( "[ERRORSTART]\n\nERROR MESSAGE: " .. tostring(event.errorMessage) .. "\n\nSTACK TRACE: " .. tostring( event.stackTrace) .. "\n\n[ERROREND]\n", 667) -- recordError takes error description (string), and error code (number)... else -- Looks fine, send it... printToConsole( " ... event looks okay, requesting log..." ) recordError( "[ERRORSTART]\n\nERROR MESSAGE: " .. tostring(event.errorMessage) .. "\n\nSTACK TRACE: " .. tostring( event.stackTrace) .. "\n\n[ERROREND]\n", 1) -- recordError takes error description (string), and error code (number)... end -- Error is logged, now what to do about the runtime? -- Return TRUE to allow app to continue (suppress error, default behaviour), return FALSE to allow app to crash (for testing only)... if( mainLibrary.suppressUnhandledErrors ~= nil ) then return mainLibrary.suppressUnhandledErrors else return true -- If nothing found, default to true (suppress)... end end Runtime:addEventListener("unhandledError", firerabbitErrorHandler)
Help/Advise/Ideas please.
Alex