Skip to content

Return response body in user facing logs when encountering 5xx responses#1557

Open
jfine wants to merge 3 commits into
mainfrom
gh-gei/issues/1556
Open

Return response body in user facing logs when encountering 5xx responses#1557
jfine wants to merge 3 commits into
mainfrom
gh-gei/issues/1556

Conversation

@jfine
Copy link
Copy Markdown
Contributor

@jfine jfine commented May 20, 2026

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

  • Did you write/update appropriate tests
  • Release notes updated (if appropriate)
  • Appropriate logging output
  • Issue linked
  • Docs updated (or issue created)
  • New package licenses are added to ThirdPartyNotices.txt (if applicable)

@jfine jfine self-assigned this May 20, 2026
Copilot AI review requested due to automatic review settings May 20, 2026 21:17
@jfine jfine enabled auto-merge May 20, 2026 21:17
Copy link
Copy Markdown
Collaborator

@brianaj brianaj left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 HttpRequestException instances in BbsClient.
  • 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

Comment thread src/Octoshift/Services/BbsClient.cs
Copy link
Copy Markdown
Collaborator

@brianaj brianaj left a comment

Choose a reason for hiding this comment

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

Oops meant to approve

@github-actions
Copy link
Copy Markdown

Unit Test Results

    1 files      1 suites   26s ⏱️
1 038 tests 1 037 ✅ 0 💤 1 ❌
1 039 runs  1 038 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit c22369c.

@github-actions
Copy link
Copy Markdown

Code Coverage

Package Line Rate Branch Rate Complexity Health
ado2gh 71% 69% 741
gei 81% 73% 608
bbs2gh 83% 78% 667
Octoshift 83% 73% 1857
Summary 81% (7988 / 9907) 73% (1980 / 2701) 3873

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.

Return response body in log output when bbs2gh encounters a 5xx

3 participants