-
Notifications
You must be signed in to change notification settings - Fork 1
/
errors.go
35 lines (29 loc) · 1.03 KB
/
errors.go
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
package syslog5424 // import "github.com/nathanaelle/syslog5424/v2"
import (
"errors"
"fmt"
)
type (
// ParseError describe an error in parsing
ParseError struct {
Buffer []byte
Pos int
Message string
}
)
var (
ErrBufferClose = errors.New("error in syslog5424 at buffer.Close()")
ErrNoConnection = errors.New("No Connection established")
ErrPos0 = errors.New("Pos 0 Found")
ErrPosNotFound = errors.New("Pos Not Found")
ErrImpossible = errors.New("NO ONE EXPECT THE RETURN OF SPANISH INQUISITION")
ErrInvalidNetwork = errors.New("Invalid Network")
ErrInvalidAddress = errors.New("Invalid Address")
ErrEmptyNetworkAddress = errors.New("Empty Network or Address")
ErrTransportIncomplete = errors.New("Transport : Incomplete Message")
ErrTransportNoHeader = errors.New("T_RFC5425 Split: no header len")
ErrTransportInvHeader = errors.New("T_RFC5425 Split: invalid header len")
)
func (pe ParseError) Error() string {
return fmt.Sprintf("{%q} %d %s", pe.Buffer, pe.Pos, pe.Message)
}