...

Source file src/github.com/letsencrypt/boulder/canceled/canceled.go

Documentation: github.com/letsencrypt/boulder/canceled

     1  package canceled
     2  
     3  import (
     4  	"context"
     5  
     6  	"google.golang.org/grpc/codes"
     7  	"google.golang.org/grpc/status"
     8  )
     9  
    10  // Is returns true if err is non-nil and is either context.Canceled, or has a
    11  // grpc code of Canceled. This is useful because cancellations propagate through
    12  // gRPC boundaries, and if we choose to treat in-process cancellations a certain
    13  // way, we usually want to treat cross-process cancellations the same way.
    14  func Is(err error) bool {
    15  	return err == context.Canceled || status.Code(err) == codes.Canceled
    16  }
    17  

View as plain text