get more meaningful errors

This commit is contained in:
Oscar Morante
2014-05-28 12:25:19 +03:00
parent 3dc83ff62c
commit a4732cc3a4

View File

@@ -38,7 +38,7 @@ MovieDB.prototype.requestToken = function(fn){
.set('Accept', 'application/json')
.end(function(res){
if(res.ok) self.token = res.body;
else throw new Error('Invalid authentication');
else throw res.error;
fn();
});