Skip to content

Commit

Permalink
chore: remove logging of bad input values
Browse files Browse the repository at this point in the history
  • Loading branch information
lzap authored and ezr-ondrej committed Sep 8, 2023
1 parent e067a69 commit 8820f43
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions internal/page/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,17 @@ type Metadata struct {

// WithOffset returns context copy with offset value.
func WithOffset(ctx context.Context, offsetStr string) context.Context {
logger := zerolog.Ctx(ctx)
offset, err := strconv.Atoi(offsetStr)
if err != nil || offset < 0 {
logger.Err(err).Msg("Offset is missing or invalid, setting offset value to 0")
offset = defaultValueOffset
}
return context.WithValue(ctx, offsetCtxKey, offset)
}

// WithLimit returns context copy with limit value.
func WithLimit(ctx context.Context, limitStr string) context.Context {
logger := zerolog.Ctx(ctx)
limit, err := strconv.Atoi(limitStr)
if err != nil || limit < 0 {
logger.Err(err).Msg("Limit is missing or invalid, setting limit value to 100")
limit = defaultValueLimit
}
return context.WithValue(ctx, limitCtxKey, limit)
Expand Down

0 comments on commit 8820f43

Please sign in to comment.