-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[connectors] Throw ExternalOAuth errors on Zendesk 403 errors (#8893)
* enh: throw ExternalOAuthTokenError on 403 when fetching article section + user * enh: throw ExternalOAuthTokenError on 403 in wrapped fetches * enh: throw ExternalOAuthTokenError on 403 in syncZendeskArticleBatchActivity * fix: remove user data from the logs * add a new error type and check * replace ts-expect errors with the typeguard * fix: do not wrap the article sync in the try catch clause
- Loading branch information
1 parent
f1fdd03
commit 5ac8932
Showing
4 changed files
with
71 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Errors returned by the library node-zendesk. | ||
* Check out https://github.com/blakmatrix/node-zendesk/blob/fa069d927bd418ee2058bb7bb913f9414e395110/src/clients/helpers.js#L262 | ||
*/ | ||
interface NodeZendeskError extends Error { | ||
statusCode: number; | ||
result: string | null; | ||
} | ||
|
||
export function isNodeZendeskForbiddenError( | ||
err: unknown | ||
): err is NodeZendeskError { | ||
return ( | ||
typeof err === "object" && | ||
err !== null && | ||
"statusCode" in err && | ||
err.statusCode === 403 | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters