12345678910111213141516171819202122232425262728293031323334353637383940 |
- package lmaxapi
- import (
- "fmt"
- "net"
- )
- type OpError struct {
- Op string
- Err error
- Code int
- isSystemFailure bool
- }
- func (e *OpError) SystemFailure() bool {
- return e.isSystemFailure
- }
- func (e *OpError) GetCode() int {
- return e.Code
- }
- func (e *OpError) Error() string {
- if e == nil {
- return "<nil>"
- }
- s := e.Op
- s += ": Code=" + fmt.Sprint(e.Code)
- s += ": " + e.Err.Error()
- return s
- }
- func (e *OpError) NetErr() (net.Error, bool) {
- err, ok := e.Err.(net.Error)
- return err, ok
- }
- func NewOpError(op string, err error, code int, isSysFail bool) *OpError {
- return &OpError{op, err, code, isSysFail}
- }
|