How can I achieve, that the caller of saveThings() get's a precise error description (A or B). Currently, my rejection of type A get's caught in the catch() clause, thus the caller always ends up with message B...
saveThings() {
return api.post(endpoint, data)
.then( response => {
if ( !response )
reject({message: 'error of type A - faulty response'});
resolve('all went well');
})
.catch( err => {
throw new Error('error of type B - call failed');
});
}