mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 02:54:20 +00:00
fix(handler): updated failed events (#7146)
This commit is contained in:
parent
b7d027e2fd
commit
aa2d642e97
@ -331,7 +331,7 @@ func (h *Handler) processEvents(ctx context.Context, config *triggerConfig) (add
|
||||
return false, err
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if err != nil && !errors.Is(err, &executionError{}) {
|
||||
rollbackErr := tx.Rollback()
|
||||
h.log().OnError(rollbackErr).Debug("unable to rollback tx")
|
||||
return
|
||||
@ -472,7 +472,7 @@ func (h *Handler) executeStatement(ctx context.Context, tx *sql.Tx, currentState
|
||||
return nil
|
||||
}
|
||||
|
||||
return err
|
||||
return &executionError{parent: err}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@ -15,6 +16,26 @@ import (
|
||||
"github.com/zitadel/zitadel/internal/zerrors"
|
||||
)
|
||||
|
||||
var _ error = (*executionError)(nil)
|
||||
|
||||
type executionError struct {
|
||||
parent error
|
||||
}
|
||||
|
||||
// Error implements error.
|
||||
func (s *executionError) Error() string {
|
||||
return fmt.Sprintf("statement failed: %v", s.parent)
|
||||
}
|
||||
|
||||
func (s *executionError) Is(err error) bool {
|
||||
_, ok := err.(*executionError)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (s *executionError) Unwrap() error {
|
||||
return s.parent
|
||||
}
|
||||
|
||||
func (h *Handler) eventsToStatements(tx *sql.Tx, events []eventstore.Event, currentState *state) (statements []*Statement, err error) {
|
||||
statements = make([]*Statement, 0, len(events))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user