-
Notifications
You must be signed in to change notification settings - Fork 42
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
feat: improve error logs #37
base: master
Are you sure you want to change the base?
Conversation
cchanche
commented
Jan 17, 2023
- Removed obsolete error log (300d187)
- Add log to suggest checking the jira-token when the jira GET request fails with status code 401 (58d17dd)
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.
hi, tiny comment!
@@ -26,7 +26,6 @@ async function run(): Promise<void> { | |||
const details = await jiraConnector.getTicketDetails(issueKey); | |||
await githubConnector.updatePrDetails(details); | |||
} catch (error) { | |||
console.log('JIRA key was not found'); |
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.
please don't remove this output, it's needed for the case when token is ok, just the jira task not exisitng
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.
Oh I see, my mistake
throw new Error(JSON.stringify(error.response, null, 4)); | ||
if (isAxiosError(error) && error?.response?.status === 401) { | ||
coreError('Jira request failed, check your jira-token.'); | ||
coreInfo('Does your jira-token include the required prefix ? See https://github.com/cakeinpanic/jira-description-action#jira-token'); |
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.
love this!
@@ -46,8 +48,9 @@ export class JiraConnector { | |||
}, | |||
}; | |||
} catch (error) { | |||
if (error.response) { | |||
throw new Error(JSON.stringify(error.response, null, 4)); | |||
if (isAxiosError(error) && error?.response?.status === 401) { |
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 also played with this and could not get a 401, even if I'm having incorrect credentials, I'm getting 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.
That's weird, I am not sure how that used to play out for me though...
Maybe a simple info-log with the error code could do the trick, whatever the type of error
Reverts part of commit 300d187