-
Notifications
You must be signed in to change notification settings - Fork 110
/
errors.go
37 lines (30 loc) · 1.58 KB
/
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
package motor
import "github.com/pkg/errors"
// NewResetZeroPositionUnsupportedError returns a standard error for when a motor
// is required to support reseting the zero position.
func NewResetZeroPositionUnsupportedError(motorName string) error {
return errors.Errorf("motor with name %s does not support ResetZeroPosition", motorName)
}
// NewPropertyUnsupportedError returns an error representing the need
// for a motor to support a particular property.
func NewPropertyUnsupportedError(prop Properties, motorName string) error {
return errors.Errorf("motor named %s has wrong support for property %#v", motorName, prop)
}
// NewZeroRPMError returns an error representing a request to move a motor at
// zero speed (i.e., moving the motor without moving the motor).
func NewZeroRPMError() error {
return errors.New("Cannot move motor at an RPM that is nearly 0")
}
// NewGoToUnsupportedError returns error when a motor is required to support GoTo feature.
func NewGoToUnsupportedError(motorName string) error {
return errors.Errorf("motor with name %s does not support GoTo", motorName)
}
// NewControlParametersUnimplementedError returns an error when a control parameters are
// unimplemented in the config being used of a controlledMotor.
func NewControlParametersUnimplementedError() error {
return errors.New("control parameters must be configured to setup a motor with controls")
}
// NewSetRPMUnsupportedError returns an error when a motor does not support SetRPM.
func NewSetRPMUnsupportedError(motorName string) error {
return errors.Errorf("motor named %s does not support SetRPM", motorName)
}