Is there a way to allow fatalLogMessage throw an exception?


#1

Hi There,

For shinobi charts on iOS, I’ve an issue as follows:

  1. It only occurs in the field - we’ve yet to reproduce this ourselves for a couple of reasons outside of our control.

  2. It is a crash in fatalLogMessage (I get why Shinobi crashes out)

  3. But, I cannot get acces to the end-user’s console to see what the log message was

So…Ideally, I’d love to have a situation where instead of exiting the app, it throws a fata exception. This would be caught by crashlytics (or similar) and I would then be able to diagnose the problem.

Any ideas?

Many thanks,

Dermot.


#2

Hi Dermot,

Sorry it’s taken a while to get back to you.

If you’re still having difficulty with this, you could try and create a custom category that overrides our call to fatalLogMessage: fromSource:

This is the implementation file similar to what we use internally to stop the chart aborting during our Unit Tests:

#import "CustomChartLogCategory.h"

@implementation ShinobiChartLog (DontAbort)

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"
+(void)fatalLogMessage:(NSString *)msg fromSource:(id)sender
#pragma clang diagnostic pop
{
    //Throw NSException, rather than abort();
    @throw [NSException exceptionWithName:@"Generic Chart Exception"
                        reason:msg userInfo:nil];
}


@end

I hope the above is of some help.

Sam