diff --git a/pubsub/example_test.go b/pubsub/example_test.go index 514ae5871a8f..07567521582a 100644 --- a/pubsub/example_test.go +++ b/pubsub/example_test.go @@ -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. } } @@ -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. } } @@ -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. } }