-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
43 lines (34 loc) · 741 Bytes
/
errors.go
File metadata and controls
43 lines (34 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package go_engine_io_parser
import (
"errors"
"fmt"
)
var (
//
errPaused = errors.New("paused")
//
errTimeout = errors.New("timeout")
//
errInvalidPayload = errors.New("invalid payload")
//
errOverlap = errors.New("overlap")
)
// OperationError is operation error.
type OperationError struct {
Operation string
Errors error
}
func newOperationError(operation string, err error) error {
return &OperationError{
Operation: operation,
Errors: err,
}
}
// Error implemented Error interface.
func (e *OperationError) Error() string {
return fmt.Sprintf("%s: %s", e.Operation, e.Errors.Error())
}
// Temporary returns true if error can retry.
func (e *OperationError) Temporary() bool {
return e.Errors != nil
}