HomeDocumentationAPI Reference
Getting StartedAPI ReferenceBug ReportingCrash ReportingAPMHelp Center

Adding Level to Exception

You can set different levels for manually reported exceptions using the following API:

let exception = NSException(name: NSExceptionName("some_exception"), reason: "Exception reason")
if let nonFatalException = CrashReporting.exception(exception) {
    nonFatalException.level = .critical
    nonFatalException.report()
}
NSException *exception = [NSException exceptionWithName:@"some_exception" reason:@"Exception reason" userInfo:nil];
IBGNonFatalException *nonFatalException = [IBGCrashReporting exception:exception];
nonFatalException.level = IBGNonFatalLevelWarning;
[nonFatalException report];
IBGNonFatalException exception = new IBGNonFatalException.Builder(new NullPointerException("Test Exception"))
	.setLevel(IBGNonFatalException.Level.CRITICAL)
	.build();
CrashReporting.report(exception);
val exception = IBGNonFatalException.Builder(NullPointerException("Test Exception"))
	.setLevel(IBGNonFatalException.Level.CRITICAL)
	.build()
CrashReporting.report(exception)

Here are the different severity levels available. In case no level is indicated, the default level would be ERROR.

.warning
.error
.critical
.info
IBGNonFatalLevelWarning
IBGNonFatalLevelError
IBGNonFatalLevelCritical
IBGNonFatalLevelInfo
IBGNonFatalException.Level.WARNING
IBGNonFatalException.Level.ERROR
IBGNonFatalException.Level.CRITICAL
IBGNonFatalException.Level.INFO