How should my web application handle common errors such as incorrect password, session timeout, etc.?
I have a class called Hotmail that contains various method such as login, logout etc.
To illustrate the confusion, I have a login method that logs the user into Hotmail via my software. The login method returns a HttpWebResponse object. But, within the login method any number of things could happen such as wrong credentials being entered or a timeout.
I'm in some confusion about how, and where to handle such errors.
In the case of the wrong credentials being entered, or a timeout, it would be pointless, or sometimes not possible to return a HttpWebResponse object. What would be the best way to handle such errors?
Should I create custom Exceptions so the code that's calling the method can check for such errors and handle them?
What's the conventional way to handle these sorts of errors as I'm sure this is a common point of confusion?