Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

INT-10878: update integration error handling #688

Merged
merged 4 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/google-cloud/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,14 @@ export class Client {
): boolean {
let isAuthorizationError = false;

if (
(err.response?.status === 403 || err.status === 403) &&
!isQuotaLimitError(err)
) {
const status =
err.response?.status !== undefined ? err.response?.status : err.status;

/**
* 404 is usually not a permission issue. In this case, when a user doesn't have access to a
* specific resource it will return a 404 status code, when its a permission issue.
*/
if ((status == 403 || status == 404) && !isQuotaLimitError(err)) {
isAuthorizationError = true;
Comment on lines +176 to 177
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

404 are usually not permissions issues, but i understand google sends it that way, can we add a comment about that?


if (
Expand Down
8 changes: 5 additions & 3 deletions src/steps/resource-manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,12 @@ export async function fetchResourceManagerSkippedProjects(
) {
const projectEntity = createProjectEntity(client.projectId, project);

logger.info(
`Adding skipped project to jobState: ${projectEntity._key}`,
);

if (!jobState.hasKey(projectEntity._key)) {
await jobState.addEntity(
createProjectEntity(client.projectId, project),
);
await jobState.addEntity(projectEntity);
}
}
}
Expand Down
Loading