Error Handling
Exception Callback
The EZ-Push SDK provides a function that allows to set a callback that is executed when exceptions occur in certain events. There are 3 different levels of severity (low, medium and high) in order to have more expressive error handling.
Example:
let ezpush = EZPush()
ezpush.setExceptionCallback { exception, severity in
switch severity {
case EZSeverity.low:
self.logger.info("\(exception.description)")
case EZSeverity.medium:
self.logger.debug("\(exception.description)")
case EZSeverity.high:
self.logger.error("\(exception.description)")
default:
self.logger.error("Unexpected Severity Level")
}
}