To show information to users, my iOS app has to call a lot of different Web services. This is why I created a Connection Helper class, which uses NSURLConnection to call my server functions. This works fine and it simplify the rest of my views, except for error handling.
Most of the time, if my helper encountered a HTTP 500 error, I want it to show an alert without an explicit implementation from my views. But for some HTTP 500, showing an alert is irrelevant and I want a different behavior coming from the view.
For now, I only have a lot of if clauses in my Connection Helper to handle different situations. I don't like this solution because it is not neat. Do you have a idea of a neat structure I could create to archive what I want to do?
Example : Calling the Web service getItem with a bad ID will return an HTTP 500, and showing an error to the user is a good behavior. But calling deleteItem with a bad ID will also return a HTTP 500, but I don't want to show this error to my user because it is irrelevant.