Adding endpoint missing exception
This commit is contained in:
parent
a52895bf3f
commit
b2e83dcf5d
|
@ -6,8 +6,9 @@ module.exports = (client) => {
|
|||
if (req.headers.authorization) {
|
||||
_.set(params, 'headers.authorization', req.headers.authorization);
|
||||
}
|
||||
return _.get(client, endpoint)
|
||||
.call(client, params)
|
||||
const api = _.get(client, endpoint);
|
||||
if (!api) throw new Error(`callWithRequest called with an invalid endpoint: ${endpoint}`);
|
||||
return api.call(client, params)
|
||||
.catch((err) => {
|
||||
if (err.status === 401) {
|
||||
const options = { realm: 'Authorization Required' };
|
||||
|
|
Loading…
Reference in a new issue