Server error management

* When the server returns an error, embed the response into the `NSError` object.
* Make promises fail when the server returns an error.