Skip to content
Permalink
Browse files
use perrors.Errorf to create new error
  • Loading branch information
wongoo committed Dec 28, 2021
1 parent b015777 commit 226f34b0685de56ca16eef10017d225548844cd6
Showing 1 changed file with 5 additions and 1 deletion.
@@ -469,7 +469,11 @@ func (d *Decoder) decInstance(typ reflect.Type, cls *classInfo) (interface{}, er
if err != nil {
return nil, perrors.Wrapf(err, "decInstance->Decode field name:%s", fieldName)
}
v, _ := b.(bool)
v, ok := b.(bool)
if !ok {
return nil, perrors.Errorf("value convert to bool failed, field name:%s", fieldName)
}

if fldRawValue.Kind() == reflect.Ptr && fldRawValue.CanSet() {
if b != nil {
field.Set(reflect.ValueOf(&v))

0 comments on commit 226f34b

Please sign in to comment.