Skip to content
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

include more detail in error logging #58

Merged
merged 1 commit into from
May 9, 2024
Merged

Conversation

bdehamer
Copy link
Collaborator

@bdehamer bdehamer commented May 9, 2024

Improves the error logging to include the name of the specific error which was thrown as well as details about any wrapped errors (if available). Previously, the user would have to enable step debug logging to get this level of detail.

Before:

image

After:

image

@bdehamer bdehamer requested a review from a team as a code owner May 9, 2024 03:36
Comment on lines -89 to +90
err instanceof Error ? err.message : /* istanbul ignore next */ `${err}`
err instanceof Error ? err : /* istanbul ignore next */ `${err}`
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Passing the entire Error object causes the error class to be displayed in the output.

Comment on lines -95 to +99
core.debug(innerErr instanceof Error ? innerErr.message : `${innerErr}}`)
core.info(
mute(innerErr instanceof Error ? innerErr.toString() : `${innerErr}`)
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Switching from debug to info so the inner error is always displayed (if available).

Signed-off-by: Brian DeHamer <bdehamer@github.com>
Copy link

@malancas malancas left a comment

Choose a reason for hiding this comment

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

lgtm

@bdehamer bdehamer merged commit b0d8b47 into main May 9, 2024
15 checks passed
@bdehamer bdehamer deleted the bdehamer/error-detail branch May 9, 2024 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants