Commit 2a94cc76 authored by yangjianbo's avatar yangjianbo
Browse files

fix(软删除): 增强错误处理,确保软删除操作中的错误类型正确

parent 150b315a
......@@ -155,7 +155,12 @@ func mutateWithClient(ctx context.Context, m ent.Mutation, fallback ent.Mutator)
value := results[0].Interface()
var err error
if !results[1].IsNil() {
err = results[1].Interface().(error)
errValue := results[1].Interface()
typedErr, ok := errValue.(error)
if !ok {
return nil, fmt.Errorf("soft delete: unexpected error type %T for %T", errValue, m)
}
err = typedErr
}
if err != nil {
return nil, err
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment