Skip to content

include more detail in error logging#58

Merged
bdehamer merged 1 commit intomainfrom
bdehamer/error-detail
May 9, 2024
Merged

include more detail in error logging#58
bdehamer merged 1 commit intomainfrom
bdehamer/error-detail

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>
@bdehamer bdehamer force-pushed the bdehamer/error-detail branch from a740a55 to ddbcc86 Compare May 9, 2024 03:39
Copy link
Contributor

@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
@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.

2 participants