-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
38 lines (30 loc) · 960 Bytes
/
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
36
37
38
package phyphox
import (
"errors"
"fmt"
)
// JSON-formatted buffer cannot be parsed correctly
var ErrBufferParse = errors.New("cannot parse the buffer correctly")
var ErrBufferVarNotExist = errors.New("buffer does not contain this variable")
// The given sensor type does not match the type of the sensor returned by RegisterXYZSensor or RegisterVSensor
type ErrSensorWrongType struct {
t SensorType
expected string
}
func (e *ErrSensorWrongType) Error() string {
return fmt.Sprintf("wrong type of sensors %s: expected %s", e.t, e.expected)
}
// The sensor type does not match any known
type ErrSensorUnknown struct {
t SensorType
}
func (e *ErrSensorUnknown) Error() string {
return fmt.Sprintf("unknown type of sensor (%s)", e.t)
}
// The experiment does not use such a sensor
type ErrSensorNotUsed struct {
t SensorType
}
func (e *ErrSensorNotUsed) Error() string {
return fmt.Sprintf("the experiment does not use sensor %s", e.t)
}