gobreaker: fix error parsing
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
be54792f21
commit
7c2b347ef4
15
gobreaker.go
15
gobreaker.go
@ -52,20 +52,21 @@ func (c *clientWrapper) Call(ctx context.Context, req client.Request, rsp interf
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
switch err.(type) {
|
merr := errors.Parse(err.Error())
|
||||||
case *errors.Error:
|
switch {
|
||||||
break
|
case merr.Code == 0:
|
||||||
default:
|
merr.Code = 503
|
||||||
err = errors.New(req.Service(), err.Error(), 503)
|
case len(merr.Id) == 0:
|
||||||
|
merr.Id = req.Service()
|
||||||
}
|
}
|
||||||
|
|
||||||
if err.(*errors.Error).Code >= 500 {
|
if merr.Code >= 500 {
|
||||||
cbAllow(false)
|
cbAllow(false)
|
||||||
} else {
|
} else {
|
||||||
cbAllow(true)
|
cbAllow(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
return err
|
return merr
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewClientWrapper returns a client Wrapper.
|
// NewClientWrapper returns a client Wrapper.
|
||||||
|
Loading…
Reference in New Issue
Block a user