Skip to content

Commit

Permalink
Merge pull request #987 from target/handle-deleted-override
Browse files Browse the repository at this point in the history
user overrides: return nil when a user override cannot be found
  • Loading branch information
mastercactapus authored Nov 3, 2020
2 parents 6881399 + 31a8bb7 commit 12a9751
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion graphql2/graphqlapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ func (a *App) Handler() http.Handler {
}

if isUnsafe && !isGQLValidation(gqlErr) {
gqlErr.Message = safeErr.Error()
log.Log(ctx, err)
gqlErr.Message = safeErr.Error()
}

var multiFieldErr validation.MultiFieldError
Expand Down
7 changes: 6 additions & 1 deletion override/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package override
import (
"context"
"database/sql"
"errors"
"time"

"github.com/target/goalert/assignment"
"github.com/target/goalert/permission"
"github.com/target/goalert/util"
"github.com/target/goalert/util/sqlutil"
"github.com/target/goalert/validation"
"github.com/target/goalert/validation/validate"
"time"

uuid "github.com/satori/go.uuid"
)
Expand Down Expand Up @@ -129,6 +131,9 @@ func (db *DB) FindOneUserOverrideTx(ctx context.Context, tx *sql.Tx, id string,
var o UserOverride
var add, rem, schedTgt sql.NullString
err = stmt.QueryRowContext(ctx, id).Scan(&o.ID, &add, &rem, &o.Start, &o.End, &schedTgt)
if errors.Is(err, sql.ErrNoRows) {
return nil, nil
}
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 12a9751

Please sign in to comment.