Return response body in user facing logs when encountering 5xx responses#1557
Open
jfine wants to merge 3 commits into
Open
Return response body in user facing logs when encountering 5xx responses#1557jfine wants to merge 3 commits into
jfine wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves troubleshooting for Bitbucket Server (BBS) API failures by capturing the 5xx response body on HttpRequestException and surfacing it in non-verbose user-facing logs, while keeping verbose logs fully detailed.
Changes:
- Attach 5xx response bodies to thrown
HttpRequestExceptioninstances inBbsClient. - Update
OctoLogger.LogError(Exception)to include an attached response body in non-verbose error output. - Add/extend unit tests and add a release note entry for the new logging behavior.
Show a summary per file
| File | Description |
|---|---|
| src/OctoshiftCLI.Tests/Octoshift/Services/OctoLoggerTests.cs | Adds a test ensuring non-verbose error output includes the response body when present on the exception. |
| src/OctoshiftCLI.Tests/Octoshift/Services/BbsClientTests.cs | Adds a test verifying 5xx responses include the response body in exception Data. |
| src/Octoshift/Services/OctoLogger.cs | Enhances error logging to print the response body context in non-verbose mode when available. |
| src/Octoshift/Services/BbsClient.cs | Creates/throws an HttpRequestException on 5xx that includes the response body in exception Data. |
| RELEASENOTES.md | Documents the new behavior for BBS2GH standard logs on 5xx failures. |
Copilot's findings
- Files reviewed: 5/5 changed files
- Comments generated: 1
Unit Test Results 1 files 1 suites 26s ⏱️ For more details on these failures, see this check. Results for commit c22369c. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request improves the logging and troubleshooting experience for Bitbucket Server (BBS) API failures by ensuring that the response body from 5xx errors is included in both the exception data and standard log output. This makes it easier to diagnose issues without needing to enable verbose logs. The changes also include comprehensive tests to verify this new behavior.
Closes #1556
ThirdPartyNotices.txt(if applicable)