@@ -17,6 +17,7 @@ limitations under the License.
17
17
package runtime
18
18
19
19
import (
20
+ "errors"
20
21
"fmt"
21
22
"net/http"
22
23
"runtime"
@@ -85,15 +86,29 @@ func logPanic(r interface{}) {
85
86
// should be packaged up into a testable and reusable object.
86
87
var ErrorHandlers = []func (error ){
87
88
logError ,
88
- (& rudimentaryErrorBackoff {
89
- lastErrorTime : time .Now (),
90
- // 1ms was the number folks were able to stomach as a global rate limit.
91
- // If you need to log errors more than 1000 times a second you
92
- // should probably consider fixing your code instead. :)
93
- minPeriod : time .Millisecond ,
94
- }).OnError ,
89
+ func (err error ) {
90
+ (& rudimentaryErrorBackoff {
91
+ lastErrorTime : time .Now (),
92
+ // 1ms was the number folks were able to stomach as a global rate limit.
93
+ // If you need to log errors more than 1000 times a second you
94
+ // should probably consider fixing your code instead. :)
95
+ minPeriod : time .Millisecond ,
96
+ }).OnError (errors .New ("error occurred ErrorHandlers" ))
97
+ },
95
98
}
96
99
100
+ //备用:
101
+ //var ErrorHandlers = []func(error){
102
+ // logError,
103
+ // (&rudimentaryErrorBackoff{
104
+ // lastErrorTime: time.Now(),
105
+ // // 1ms was the number folks were able to stomach as a global rate limit.
106
+ // // If you need to log errors more than 1000 times a second you
107
+ // // should probably consider fixing your code instead. :)
108
+ // minPeriod: time.Millisecond,
109
+ // }).OnError,
110
+ //}
111
+
97
112
// HandlerError is a method to invoke when a non-user facing piece of code cannot
98
113
// return an error and needs to indicate it has been ignored. Invoking this method
99
114
// is preferable to logging the error - the default behavior is to log but the
0 commit comments