From 298a68fa97cbc79084f60b47a80330c7c7838055 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 17 Dec 2024 16:15:33 -0800 Subject: [PATCH] submissions: fix unhandled error path causing silent failure --- pkg/datastore/gormstore/script_policy.go | 2 ++ pkg/datastore/gormstore/scripts.go | 1 + pkg/datastore/gormstore/submissions.go | 1 + 3 files changed, 4 insertions(+) diff --git a/pkg/datastore/gormstore/script_policy.go b/pkg/datastore/gormstore/script_policy.go index 72f1b6f..d8dbb97 100644 --- a/pkg/datastore/gormstore/script_policy.go +++ b/pkg/datastore/gormstore/script_policy.go @@ -19,6 +19,7 @@ func (env *ScriptPolicy) Get(ctx context.Context, id int64) (model.ScriptPolicy, if errors.Is(err, gorm.ErrRecordNotFound) { return mdl, datastore.ErrNotExist } + return mdl, err } return mdl, nil } @@ -29,6 +30,7 @@ func (env *ScriptPolicy) GetFromHash(ctx context.Context, hash uint64) (model.Sc if errors.Is(err, gorm.ErrRecordNotFound) { return mdl, datastore.ErrNotExist } + return mdl, err } return mdl, nil } diff --git a/pkg/datastore/gormstore/scripts.go b/pkg/datastore/gormstore/scripts.go index d792f3c..1aa7f1f 100644 --- a/pkg/datastore/gormstore/scripts.go +++ b/pkg/datastore/gormstore/scripts.go @@ -19,6 +19,7 @@ func (env *Scripts) Get(ctx context.Context, id int64) (model.Script, error) { if errors.Is(err, gorm.ErrRecordNotFound) { return mdl, datastore.ErrNotExist } + return mdl, err } return mdl, nil } diff --git a/pkg/datastore/gormstore/submissions.go b/pkg/datastore/gormstore/submissions.go index 7e71c60..8066511 100644 --- a/pkg/datastore/gormstore/submissions.go +++ b/pkg/datastore/gormstore/submissions.go @@ -20,6 +20,7 @@ func (env *Submissions) Get(ctx context.Context, id int64) (model.Submission, er if errors.Is(err, gorm.ErrRecordNotFound) { return submission, datastore.ErrNotExist } + return submission, err } return submission, nil }