Skip to content

Commit

Permalink
Fix docs correct error handling in golang Headers & trailers section (#…
Browse files Browse the repository at this point in the history
…198)

### Summary

This PR fixes a minor issue in the documentation's error handling
example. The original example incorrectly referenced `err` instead of
`connectErr` when accessing metadata, which could lead to confusion.

### Changes
- Updated the error handling example to correctly use
`connectErr.Meta().Get("Greet-Version")` instead of
`err.Meta().Get("Greet-Version")`.

Signed-off-by: s4s7 <[email protected]>
Co-authored-by: Sri Krishna <[email protected]>
  • Loading branch information
s4s7 and srikrsna-buf authored Oct 1, 2024
1 parent ebf9e16 commit c1a31e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/go/headers-and-trailers.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func call() {
connect.NewRequest(&greetv1.GreetRequest{}),
)
if connectErr := new(connect.Error); errors.As(err, &connectErr) {
fmt.Println(err.Meta().Get("Greet-Version"))
fmt.Println(connectErr.Meta().Get("Greet-Version"))
}
}
```
Expand Down

0 comments on commit c1a31e9

Please sign in to comment.