Browse Source
Merge pull request #312 from StandHeo/main
deferDo method logic should not be wrapped by defer agin,thus results panic ignored and not do fail method
alpha
yedf2
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
8 additions and
10 deletions
-
dtmcli/dtmimp/utils.go
|
|
@ -235,16 +235,14 @@ func RespAsErrorCompatible(resp *resty.Response) error { |
|
|
|
|
|
|
|
|
// DeferDo a common defer do used in dtmcli/dtmgrpc
|
|
|
// DeferDo a common defer do used in dtmcli/dtmgrpc
|
|
|
func DeferDo(rerr *error, success func() error, fail func() error) { |
|
|
func DeferDo(rerr *error, success func() error, fail func() error) { |
|
|
defer func() { |
|
|
if x := recover(); x != nil { |
|
|
if x := recover(); x != nil { |
|
|
_ = fail() |
|
|
_ = fail() |
|
|
panic(x) |
|
|
panic(x) |
|
|
} else if *rerr != nil { |
|
|
} else if *rerr != nil { |
|
|
_ = fail() |
|
|
_ = fail() |
|
|
} else { |
|
|
} else { |
|
|
*rerr = success() |
|
|
*rerr = success() |
|
|
} |
|
|
} |
|
|
|
|
|
}() |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Escape solve CodeQL reported problem
|
|
|
// Escape solve CodeQL reported problem
|
|
|
|