forked from l1va/gofins
/
error.go
41 lines (30 loc) · 773 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
36
37
38
39
40
41
package gofins
import (
"fmt"
"time"
)
// Client errors
type ResponseTimeoutError struct {
duration time.Duration
}
func (e ResponseTimeoutError) Error() string {
return fmt.Sprintf("Response timeout of %d has been reached", e.duration)
}
type IncompatibleMemoryAreaError struct {
area byte
}
func (e IncompatibleMemoryAreaError) Error() string {
return fmt.Sprintf("The memory area is incompatible with the data type to be read: 0x%X", e.area)
}
// Driver errors
type BCDBadDigitError struct {
v string
val uint64
}
func (e BCDBadDigitError) Error() string {
return fmt.Sprintf("Bad digit in BCD decoding: %s = %d", e.v, e.val)
}
type BCDOverflowError struct{}
func (e BCDOverflowError) Error() string {
return "Overflow occurred in BCD decoding"
}