snipsco / Postal

A Swift framework for working with emails
MIT License
652 stars 81 forks source link

refactor error handling #8

Closed superlopuh closed 8 years ago

superlopuh commented 8 years ago

Just an idea for an alternative way of handling C functions that return an error code.

This PR eliminates the extensions on Int and Int32 for error creation, and adds a static .attempt(_:) method to PostalErrorTypes that throws.

This seems to me to be a bit more of an explicit and readable than the existing code.

WDYT?

jeremiegirault commented 8 years ago

Seen with @klefevre I close this one.

=> These are C error codes so let's keep it simple at the moment.

A PR for making IMAPError and IMFError disappearing would however provide great API value