diff --git a/device/alsa/alsa_test.go b/device/alsa/alsa_test.go index 9b9ce080..ce413bc0 100644 --- a/device/alsa/alsa_test.go +++ b/device/alsa/alsa_test.go @@ -56,9 +56,12 @@ func TestDevice(t *testing.T) { err := ai.Setup(c) // Log any config errors, otherwise if there was an error opening a device, skip // this test since not all testing environments will have recording devices. - if _, ok := err.(device.MultiError); err != nil && ok { + switch err := err.(type) { + case nil: + // Do nothing. + case device.MultiError: t.Logf("errors from configuring device: %s", err.Error()) - } else if err != nil { + default: t.Skip(err) } err = ai.Start() diff --git a/revid/audio_linux.go b/revid/audio_linux.go index 1553dc47..6d297463 100644 --- a/revid/audio_linux.go +++ b/revid/audio_linux.go @@ -53,9 +53,12 @@ func (r *Revid) setupAudio() error { // Configure ALSA device. r.cfg.Logger.Log(logger.Debug, "configuring input device") err := d.Setup(r.cfg) - if _, ok := err.(device.MultiError); err != nil && ok { + switch err := err.(type) { + case nil: + // Do nothing. + case device.MultiError: r.cfg.Logger.Log(logger.Warning, "errors from configuring input device", "errors", err) - } else if err != nil { + default: return err } r.cfg.Logger.Log(logger.Info, "input device configured")