Handle error responses as well

Does require including $q to do the promise rejection.