Idiomatic 'iota' enumeration for serial error codes
This commit is contained in:
14
serial.go
14
serial.go
@@ -39,13 +39,13 @@ type SerialPortError struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ERROR_PORT_BUSY = 1
|
ERROR_PORT_BUSY = iota
|
||||||
ERROR_PORT_NOT_FOUND = 2
|
ERROR_PORT_NOT_FOUND
|
||||||
ERROR_INVALID_SERIAL_PORT = 3
|
ERROR_INVALID_SERIAL_PORT
|
||||||
ERROR_PERMISSION_DENIED = 4
|
ERROR_PERMISSION_DENIED
|
||||||
ERROR_INVALID_PORT_SPEED = 5
|
ERROR_INVALID_PORT_SPEED
|
||||||
ERROR_ENUMERATING_PORTS = 6
|
ERROR_ENUMERATING_PORTS
|
||||||
ERROR_OTHER = 99
|
ERROR_OTHER
|
||||||
)
|
)
|
||||||
|
|
||||||
func (e SerialPortError) Error() string {
|
func (e SerialPortError) Error() string {
|
||||||
|
|||||||
Reference in New Issue
Block a user