diff --git a/db/template.go b/db/template.go index 985e5571d..dc656e0e5 100644 --- a/db/template.go +++ b/db/template.go @@ -14,14 +14,14 @@ import ( // CreateTemplate creates a new workflow template func (d TinkDB) CreateTemplate(ctx context.Context, name string, data string, id uuid.UUID) error { - tx, err := d.instance.BeginTx(ctx, &sql.TxOptions{Isolation: sql.LevelSerializable}) + _, err := wflow.Parse([]byte(data)) if err != nil { - return errors.Wrap(err, "BEGIN transaction") + return err } - _, err = wflow.Parse([]byte(data)) + tx, err := d.instance.BeginTx(ctx, &sql.TxOptions{Isolation: sql.LevelSerializable}) if err != nil { - return err + return errors.Wrap(err, "BEGIN transaction") } _, err = tx.Exec(`