mikrotik-exporter/vendor/gopkg.in/routeros.v2/error.go
2017-08-27 23:27:11 -04:00

36 lines
827 B
Go

package routeros
import (
"errors"
"gopkg.in/routeros.v2/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
}