Skip to content

fix: return response even if error occurs while decoding agent message#82

Open
alanshaw wants to merge 1 commit intomainfrom
ash/fix/return-response-even-if-error
Open

fix: return response even if error occurs while decoding agent message#82
alanshaw wants to merge 1 commit intomainfrom
ash/fix/return-response-even-if-error

Conversation

@alanshaw
Copy link
Member

Return the repsonse even when an error occurs decoding the agent message. This allows a client to inspect the status code, headers and body, which may contain clues to why the failure happened.

@alanshaw alanshaw requested a review from a team November 25, 2025 11:04
@alanshaw alanshaw requested a review from volmedo as a code owner November 25, 2025 11:04
@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
client/retrieval/connection.go 0.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
client/retrieval/connection.go 57.43% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@volmedo volmedo left a comment

Choose a reason for hiding this comment

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

Ok, although inspecting anything beyond the error when the error is not nil feels quite weird in Go.

A more idiomatic alternative would be to define an error type such as:

type ResponseDecodingError struct {
    msg  string
    resp transport.HTTPResponse
}

func (rde *ResponseDecodingError) Error() string {
    return rde.msg
}

func (rde *ResponseDecodingError) Response() transport.HTTPResponse {
    return rde.resp
}

Then the client could do error.As and fetch the response that failed to decode.

Just a non-blocking suggestion.

Copy link
Member

@Peeja Peeja left a comment

Choose a reason for hiding this comment

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

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.

3 participants