Skip to content

Commit

Permalink
renamed dontHandle to dontHandleErrs
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsMeSamey committed Nov 21, 2024
1 parent 8ec9427 commit 5697339
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ type StructValidator interface {
// Bind struct
type Bind struct {
ctx Ctx
dontHandle bool
dontHandleErrs bool
}

// If you want to handle binder errors manually, you can use `WithoutAutoHandling`.
// It's default behavior of binder.
func (b *Bind) WithoutAutoHandling() *Bind {
b.dontHandle = true
b.dontHandleErrs = true

Check warning on line 29 in bind.go

View check run for this annotation

Codecov / codecov/patch

bind.go#L28-L29

Added lines #L28 - L29 were not covered by tests

return b
}
Expand All @@ -35,14 +35,14 @@ func (b *Bind) WithoutAutoHandling() *Bind {
// If there's an error, it will return the error and set HTTP status to `400 Bad Request`.
// You must still return on error explicitly
func (b *Bind) WithAutoHandling() *Bind {
b.dontHandle = false
b.dontHandleErrs = false

return b
}

// Check WithAutoHandling/WithoutAutoHandling errors and return it by usage.
func (b *Bind) returnErr(err error) error {
if err == nil || b.dontHandle {
if err == nil || b.dontHandleErrs {
return err
}

Expand Down
2 changes: 1 addition & 1 deletion ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -1861,7 +1861,7 @@ func (c *DefaultCtx) Bind() *Bind {
if c.bind == nil {
c.bind = &Bind{
ctx : c,
dontHandle: true,
dontHandleErrs: true,
}
}
return c.bind
Expand Down

0 comments on commit 5697339

Please sign in to comment.