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

Repeat error message prefix when token retrieval failure occurs #815

Closed
atc0005 opened this issue Nov 11, 2024 · 1 comment · Fixed by #821
Closed

Repeat error message prefix when token retrieval failure occurs #815

atc0005 opened this issue Nov 11, 2024 · 1 comment · Fixed by #821
Assignees
Labels
Milestone

Comments

@atc0005
Copy link
Owner

atc0005 commented Nov 11, 2024

Someone reported a failure for the list-emails binary today and shared an error message snippet.

The first line only:

failed to retrieve token: failed to retrieve token: oauth2: cannot fetch token: 401 Unauthorized

The error message should instead be (at a minimum reduced to):

-failed to retrieve token: failed to retrieve token: oauth2: cannot fetch token: 401 Unauthorized
+failed to retrieve token: oauth2: cannot fetch token: 401 Unauthorized

Further tweaks could be applied to further refine the message, but we can at least not repeat the prefix.


Note: The error is occurring because the associated secret has expired and needs to be regenerated.

The detailed error message (not shown here) offers guidance and also specifies the app ID to help the user locate the Azure App entry to generate a new secret.

@atc0005 atc0005 added this to the Next Dev Release milestone Nov 11, 2024
@atc0005 atc0005 self-assigned this Nov 11, 2024
@atc0005
Copy link
Owner Author

atc0005 commented Nov 11, 2024

Focus here:

return nil, fmt.Errorf(
"failed to retrieve token: %w",
result,
)

and here:

return fmt.Errorf(
"failed to retrieve token: %w",
err,
)

@atc0005 atc0005 modified the milestones: Next Dev Release, v0.8.16 Nov 11, 2024
atc0005 added a commit that referenced this issue Nov 12, 2024
Reduce duplication by clarifying the intent behind the calling
function (by way of updating the wrapping error msg prefix).

refs GH-815
atc0005 added a commit that referenced this issue Nov 12, 2024
Reduce duplication by clarifying the intent behind the calling
function (by way of updating the wrapping error msg prefix).

refs GH-815
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant