Skip to content
This repository has been archived by the owner on Jul 31, 2021. It is now read-only.

Commit

Permalink
report 403 errors for hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
luisbritos committed Nov 12, 2020
1 parent db367fd commit 9eaf160
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
2 changes: 1 addition & 1 deletion src/auth0/handlers/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export default class HooksHandler extends DefaultHandler {

return this.existing;
} catch (err) {
if (err.statusCode === 404 || err.statusCode === 403 || err.statusCode === 501) {
if (err.statusCode === 404 || err.statusCode === 501) {
return [];
}
throw err;
Expand Down
17 changes: 0 additions & 17 deletions tests/auth0/handlers/hooks.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,23 +254,6 @@ describe('#hooks handler', () => {
expect(data).to.deep.equal([]);
});

it('should return an empty array for 403 status code', async () => {
const auth0 = {
hooks: {
getAll: () => {
const error = new Error('This endpoint is disabled for your tenant.');
error.statusCode = 403;
throw error;
}
},
pool
};

const handler = new hooks.default({ client: auth0, config });
const data = await handler.getType();
expect(data).to.deep.equal([]);
});

it('should throw an error for all other failed requests', async () => {
const auth0 = {
hooks: {
Expand Down

0 comments on commit 9eaf160

Please sign in to comment.