Skip to content

Commit

Permalink
docs(pubsub): check for nil responses for receive examples (#9516)
Browse files Browse the repository at this point in the history
* docs(pubsub): check for nil responses for receive examples

* make code compile actually
  • Loading branch information
hongalex authored Mar 6, 2024
1 parent e54989e commit 6deb969
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pubsub/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ func ExampleSubscription_Receive() {
// NOTE: May be called concurrently; synchronize access to shared memory.
m.Ack()
})
if err != context.Canceled {
if err != nil && err != context.Canceled {
// TODO: Handle error.
}
}
Expand All @@ -324,7 +324,7 @@ func ExampleSubscription_Receive_maxExtension() {
// TODO: Handle message.
m.Ack()
})
if err != context.Canceled {
if err != nil && err != context.Canceled {
// TODO: Handle error.
}
}
Expand All @@ -345,7 +345,7 @@ func ExampleSubscription_Receive_maxOutstanding() {
// TODO: Handle message.
m.Ack()
})
if err != context.Canceled {
if err != nil && err != context.Canceled {
// TODO: Handle error.
}
}
Expand Down

0 comments on commit 6deb969

Please sign in to comment.