diff --git a/dtmcli/dtmimp/utils.go b/dtmcli/dtmimp/utils.go index 1e5607a..3127fbe 100644 --- a/dtmcli/dtmimp/utils.go +++ b/dtmcli/dtmimp/utils.go @@ -235,16 +235,14 @@ func RespAsErrorCompatible(resp *resty.Response) error { // DeferDo a common defer do used in dtmcli/dtmgrpc func DeferDo(rerr *error, success func() error, fail func() error) { - defer func() { - if x := recover(); x != nil { - _ = fail() - panic(x) - } else if *rerr != nil { - _ = fail() - } else { - *rerr = success() - } - }() + if x := recover(); x != nil { + _ = fail() + panic(x) + } else if *rerr != nil { + _ = fail() + } else { + *rerr = success() + } } // Escape solve CodeQL reported problem