|
|
@ -8,6 +8,7 @@ import (
|
|
|
|
"path/filepath"
|
|
|
|
"path/filepath"
|
|
|
|
"reflect"
|
|
|
|
"reflect"
|
|
|
|
"sort"
|
|
|
|
"sort"
|
|
|
|
|
|
|
|
"strings"
|
|
|
|
"time"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -464,11 +465,13 @@ func (a Author) String() string {
|
|
|
|
func HandleAction(action interface{}, context *Context) (err error) {
|
|
|
|
func HandleAction(action interface{}, context *Context) (err error) {
|
|
|
|
defer func() {
|
|
|
|
defer func() {
|
|
|
|
if r := recover(); r != nil {
|
|
|
|
if r := recover(); r != nil {
|
|
|
|
switch r.(type) {
|
|
|
|
// Try to detect a known reflection error from *this scope*, rather than
|
|
|
|
case error:
|
|
|
|
// swallowing all panics that may happen when calling an Action func.
|
|
|
|
err = r.(error)
|
|
|
|
s := fmt.Sprintf("%v", r)
|
|
|
|
default:
|
|
|
|
if strings.HasPrefix(s, "reflect: ") && strings.Contains(s, "too many input arguments") {
|
|
|
|
err = NewExitError(fmt.Sprintf("ERROR unknown Action error: %v. See %s", r, appActionDeprecationURL), 2)
|
|
|
|
err = NewExitError(fmt.Sprintf("ERROR unknown Action error: %v. See %s", r, appActionDeprecationURL), 2)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
panic(r)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
}()
|
|
|
|