timeout.go 465 B

1234567891011121314151617181920
  1. // Copyright 2013 Google Inc. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. package appengine
  5. import "golang.org/x/net/context"
  6. // IsTimeoutError reports whether err is a timeout error.
  7. func IsTimeoutError(err error) bool {
  8. if err == context.DeadlineExceeded {
  9. return true
  10. }
  11. if t, ok := err.(interface {
  12. IsTimeout() bool
  13. }); ok {
  14. return t.IsTimeout()
  15. }
  16. return false
  17. }