fix: switch reflect order

This commit is contained in:
franklin 2023-07-10 09:29:54 +02:00
parent 57cd3acf38
commit 0715ab52ad

View File

@ -111,8 +111,8 @@ func Reply(response []interface{}, stats *CallStats, r *http.Request, w http.Res
stats.Marshalling = time.Since(serializationStart)
if len(response) > 0 {
errResp := response[len(response)-1]
if !reflect.ValueOf(errResp).IsNil() {
if v, ok := errResp.(error); ok {
if v, ok := errResp.(error); ok && v != nil {
if !reflect.ValueOf(v).IsNil() {
stats.ErrorCode = 1
stats.ErrorMessage = v.Error()
if v, ok := v.(interface {