From 651c1eefc7ea0dc157d56ae07e486ca8d7b655d5 Mon Sep 17 00:00:00 2001 From: Sung Date: Sun, 12 Oct 2025 16:01:50 -0700 Subject: [PATCH] Handle errors --- pkg/cli/cmd/sync/sync.go | 4 +++- pkg/cli/infra/init.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/cli/cmd/sync/sync.go b/pkg/cli/cmd/sync/sync.go index a1fea893..1db3848e 100644 --- a/pkg/cli/cmd/sync/sync.go +++ b/pkg/cli/cmd/sync/sync.go @@ -1060,7 +1060,9 @@ func newRun(ctx context.DnoteCtx) infra.RunEFunc { } } - tx.Commit() + if err := tx.Commit(); err != nil { + return errors.Wrap(err, "committing transaction") + } log.Success("success\n") diff --git a/pkg/cli/infra/init.go b/pkg/cli/infra/init.go index 0d2d767a..4bbaae6e 100644 --- a/pkg/cli/infra/init.go +++ b/pkg/cli/infra/init.go @@ -291,7 +291,9 @@ func InitSystem(ctx context.DnoteCtx) error { return errors.Wrapf(err, "initializing system config for %s", consts.SystemLastSyncAt) } - tx.Commit() + if err := tx.Commit(); err != nil { + return errors.Wrap(err, "committing transaction") + } return nil }