errors as string for now
All checks were successful
Build and Publish / Metadata (push) Successful in 9s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 1m30s
Build and Publish / BuildAndDeployArm64 (push) Successful in 4m6s

This commit is contained in:
matst80
2025-10-14 15:36:50 +02:00
parent cbbae3dfd3
commit b029a9d05a

View File

@@ -12,7 +12,7 @@ import (
type ApplyResult struct { type ApplyResult struct {
Type string `json:"type"` Type string `json:"type"`
Mutation proto.Message `json:"mutation"` Mutation proto.Message `json:"mutation"`
Error error `json:"error,omitempty"` Error string `json:"error,omitempty"`
} }
type MutationRegistry interface { type MutationRegistry interface {
@@ -167,11 +167,11 @@ func (r *ProtoMutationRegistry) Apply(grain any, msg ...proto.Message) ([]ApplyR
entry, ok := r.mutationRegistry[rt] entry, ok := r.mutationRegistry[rt]
r.mutationRegistryMu.RUnlock() r.mutationRegistryMu.RUnlock()
if !ok { if !ok {
results = append(results, ApplyResult{Error: ErrMutationNotRegistered, Type: rt.Name(), Mutation: m}) results = append(results, ApplyResult{Error: ErrMutationNotRegistered.Error(), Type: rt.Name(), Mutation: m})
continue continue
} }
err := entry.Handle(grain, m) err := entry.Handle(grain, m)
results = append(results, ApplyResult{Error: err, Type: rt.Name(), Mutation: m}) results = append(results, ApplyResult{Error: err.Error(), Type: rt.Name(), Mutation: m})
} }
// if entry.updateTotals { // if entry.updateTotals {