I wouldn’t have thought this was a difference between production/dev mode in the code. If I pass in a bad string for the URL, that’s an error regardless of mode.
It’s more that Objective C exceptions are not handled well in Swift. There is, however, automatic translation and handling of errors using an NSError
pointer in Objective C that gets translated into a throws
in Swift (even though it works a bit differently to a traditional exception).
Apple’s recommendation is to use errors over exceptions:
Instead of exceptions, error objects (NSError) and the Cocoa error-delivery mechanism are the recommended way to communicate expected errors in Cocoa applications
Would you consider a change where the Snowplow iOS SDK moves to errors over exceptions? Or supports both modes for easy consumption from Swift?