-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ARC-1429: Return 404 if Jira has been renamed. #1268
Changes from all commits
2e0df60
db9d2c2
499ce29
b584826
1289f29
2335eea
7cfe57e
3b24e2e
db6e17b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ export const getJiraErrorMessages = (status: number) => { | |
case 403: | ||
return "HTTP 403 - The JWT token used does not correspond to an app that defines the jiraDevelopmentTool module, or the app does not define the 'WRITE' scope"; | ||
case 404: | ||
return "HTTP 404 - Bad REST path, or Jira instance not found or temporarily suspended."; | ||
return "HTTP 404 - Bad REST path, or Jira instance not found, renamed or temporarily suspended."; | ||
case 413: | ||
return "HTTP 413 - Data is too large. Submit fewer devinfo entities in each payload."; | ||
case 429: | ||
|
@@ -147,13 +147,16 @@ const instrumentRequest = (response) => { | |
const instrumentFailedRequest = (baseURL: string, logger: Logger) => { | ||
return async (error: AxiosError) => { | ||
instrumentRequest(error?.response); | ||
if (error.response?.status === 503) { | ||
if (error.response?.status === 503 || error.response?.status === 405) { | ||
try { | ||
await axios.get("/status", { baseURL }); | ||
} catch (e) { | ||
if (e.response.status === 503) { | ||
logger.info(`503 from Jira: Jira instance '${baseURL}' has been deactivated, is suspended or does not exist. Returning 404 to our application.`); | ||
error.response.status = 404; | ||
} else if (e.response.status === 302) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... and this one too... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but probably not a big deal cause this is error handling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I think it's ok because I'm just adding more logging to an error that is already being thrown. If these conditions aren't met, we will reject it anyways on line 163. |
||
logger.info(`405 from Jira: Jira instance '${baseURL}' has been renamed. Returning 404 to our application.`); | ||
error.response.status = 404; | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally this should be feature-flagged...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we are changing the behaviour?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm considering it fine because of the comment below.