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
pull/316/head
yedf2 4 years ago
committed by GitHub
parent
commit
caf00e50ec
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      dtmcli/dtmimp/utils.go

18
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

Loading…
Cancel
Save