authelia/internal/commands/util.go

19 lines
322 B
Go
Raw Normal View History

package commands
import (
"fmt"
)
func recoverErr(i interface{}) error {
switch v := i.(type) {
case nil:
return nil
case string:
return fmt.Errorf("recovered panic: %s", v)
case error:
return fmt.Errorf("recovered panic: %w", v)
default:
return fmt.Errorf("recovered panic with unknown type: %v", v)
}
}