2014-02-03 03:32:22 +04:00
|
|
|
// Copyright 2013 Google Inc. All rights reserved.
|
|
|
|
// Use of this source code is governed by the Apache 2.0
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package appengine
|
|
|
|
|
2015-01-28 08:44:06 +03:00
|
|
|
import "golang.org/x/net/context"
|
|
|
|
|
2014-02-03 03:32:22 +04:00
|
|
|
// IsTimeoutError reports whether err is a timeout error.
|
|
|
|
func IsTimeoutError(err error) bool {
|
2015-01-28 08:44:06 +03:00
|
|
|
if err == context.DeadlineExceeded {
|
|
|
|
return true
|
|
|
|
}
|
2014-02-03 03:32:22 +04:00
|
|
|
if t, ok := err.(interface {
|
|
|
|
IsTimeout() bool
|
|
|
|
}); ok {
|
|
|
|
return t.IsTimeout()
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|