Skip to content

Commit

Permalink
Fix api error return
Browse files Browse the repository at this point in the history
  • Loading branch information
romainberger committed Jun 18, 2015
1 parent fc665b1 commit acf4b2a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/dataProvider.js
Expand Up @@ -42,7 +42,7 @@ function dataProvider(expose, url, options) {
}
});
} else {
resolve(err.response.body.error);
resolve(err.response.body);
}
} else {
if (options.set) {
Expand Down
2 changes: 1 addition & 1 deletion src/dataProvider.js
Expand Up @@ -36,7 +36,7 @@ export default function dataProvider(expose, url, options) {
})
}
else {
resolve(err.response.body.error)
resolve(err.response.body)
}
}
else {
Expand Down
4 changes: 2 additions & 2 deletions test/dataProvider.js
Expand Up @@ -87,8 +87,8 @@ describe('Data Provider', function() {

it('should return an API error', function(done) {
provider('error', 'https://api.dailymotion.com/error').then(function(data) {
expect(data).to.have.all.keys('code', 'message', 'type')
expect(data.code).to.equal(501)
expect(data).to.have.key('error')
expect(data.error.code).to.equal(501)
done()
})
})
Expand Down

0 comments on commit acf4b2a

Please sign in to comment.