Handle error responses as well

Does require including $q to do the promise rejection.
Merge pull request #1 from Psykar/master

Handle error responses as well