In the js-data library, I have added a custom query with the addAction() method as shown here. Now when my server returns a 4xx error code upon calling that custom action, an error is thrown but the server response (which is send) is nowhere to be found:
store.getMapper('school').getTeacherReports(1234, {
basePath: 'reports'
}).then(function(response) {
console.log('response', response.data)
}).catch(function(err) {
console.log('err', err);
})
How should I handle this? Is there some method I don't know of that I should use? I already tried the response and responseError properties in the addAction() according to the docs.
The
thenfunction can take two parameters:So here is how you can handle the rejection due to the 4xx error: