forked from go-routeros/routeros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
error.go
executable file
·35 lines (28 loc) · 838 Bytes
/
error.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 routeros
import (
"errors"
"github.com/hainguyen8y/routeros/proto"
)
var (
errAlreadyAsync = errors.New("Async() has already been called")
errAsyncLoopEnded = errors.New("Async() loop has ended - probably read error")
)
// UnknownReplyError records the sentence whose Word is unknown.
type UnknownReplyError struct {
Sentence *proto.Sentence
}
func (err *UnknownReplyError) Error() string {
return "unknown RouterOS reply word: " + err.Sentence.Word
}
// DeviceError records the sentence containing the error received from the device.
// The sentence may have Word !trap or !fatal.
type DeviceError struct {
Sentence *proto.Sentence
}
func (err *DeviceError) Error() string {
m := err.Sentence.Map["message"]
if m == "" {
m = "unknown error: " + err.Sentence.String()
}
return "from RouterOS device: " + m
}