platforms/joystick: wrap loadfile error to more easily handle OS differences
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
2a352ed250
commit
7ed78ccb4b
|
@ -177,7 +177,7 @@ func (j *Driver) initConfig() error {
|
|||
default:
|
||||
err := j.loadFile()
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("loadfile error: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ func TestDriverHandleEvent(t *testing.T) {
|
|||
if err := d.initConfig(); err != nil {
|
||||
t.Errorf("initConfig() error: %v", err)
|
||||
}
|
||||
|
||||
|
||||
d.initEvents()
|
||||
|
||||
// left x stick
|
||||
|
@ -106,5 +106,5 @@ func TestDriverHandleEvent(t *testing.T) {
|
|||
func TestDriverInvalidConfig(t *testing.T) {
|
||||
d, _ := initTestDriver("./configs/doesnotexist")
|
||||
err := d.Start()
|
||||
gobottest.Assert(t, strings.Contains(err.Error(), "open ./configs/doesnotexist: no such file or directory"), true)
|
||||
gobottest.Assert(t, strings.Contains(err.Error(), "loadfile error"), true)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue