mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
19 lines
322 B
Go
19 lines
322 B
Go
|
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)
|
||
|
}
|
||
|
}
|