Skip to content

🔥 feat: add BindError type with source and field metadata#4120

Merged
ReneWerner87 merged 12 commits into
gofiber:mainfrom
loderunner:main
Mar 2, 2026
Merged

🔥 feat: add BindError type with source and field metadata#4120
ReneWerner87 merged 12 commits into
gofiber:mainfrom
loderunner:main

Conversation

@loderunner
Copy link
Copy Markdown
Contributor

@loderunner loderunner commented Mar 1, 2026

Description

Implements #4118.

All Bind() methods now return *BindError on parse failure, giving callers the binding source and field that failed as structured data rather than an opaque error string.

Fixes #4118

Changes introduced

What changed

New type and constants in bind.go:

type BindError struct {
    Source string // "uri", "query", "body", "header", "cookie", or "respHeader"
    Field  string // struct field/tag key that failed (best-effort, may be empty)
    Err    error  // underlying error
}

const (
    BindSourceURI        = "uri"
    BindSourceQuery      = "query"
    BindSourceHeader     = "header"
    BindSourceCookie     = "cookie"
    BindSourceBody       = "body"
    BindSourceRespHeader = "respHeader"
)

All bind methods (URI, Query, Header, Cookie, RespHeader, JSON, XML, CBOR, MsgPack, Form, Body, and All) now return *BindError instead of a raw error when parsing fails. BindError implements Unwrap, so errors.As traverses the full chain — you can extract either the *BindError or the underlying error type directly:

if err := c.Bind().All(&req); err != nil {
    var be *fiber.BindError
    if errors.As(err, &be) && be.Source == fiber.BindSourceURI {
        return c.Status(fiber.StatusNotFound).JSON(fiber.Map{"error": "not found"})
    }
    return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": "invalid request"})
}

binder/mapping.go: Removed the "bind: " prefix that parseToStruct prepended to schema errors. The field/source context is now carried by BindError instead.

Gotchas

Validation errors are not bind errors. Errors from a registered StructValidator are returned as-is and not wrapped in *BindError. errors.As(err, &be) can be used to tell them apart — it succeeds only for parse failures.

Auto-handling suppresses BindError. With WithAutoHandling(), parse failures are converted to an HTTP 400 response and the method returns *fiber.Error. BindError is only returned in default (manual) mode.

Breaking change: error message strings

Two error string formats changed:

  1. Schema errors from binder.parseToStruct lost the "bind: " prefix — "bind: name is empty""name is empty".
  2. Errors returned from bind methods gained a structured prefix — bare schema error → bind "field" from source: underlying error.

errors.Is / errors.As chains are unaffected. Code that string-matches err.Error() will need updating.

  • Benchmarks: no allocations on the happy path; newBindError allocates only on error.
  • Documentation Update: docs/api/bind.md updated with a BindError section covering the type, source constants, source-branching example, and validation vs binding error distinction.
  • Changelog/What's New: BindError type, BindSource* constants, structured error metadata on all Bind() methods.
  • Migration Guide: error string format changed (see above); no API surface changes.
  • API Alignment with Express: aligns with express-validator's location/path fields.
  • API Longevity: additive only; BindError implements error and Unwrap, existing code unaffected.
  • Examples: see docs/api/bind.md.

Type of change

  • New feature (non-breaking change which adds functionality)
  • Enhancement (improvement to existing features and functionality)
  • Documentation update (changes to documentation)

Checklist

  • Followed the inspiration of the Express.js framework for new functionalities, making them similar in usage.
  • Conducted a self-review of the code and provided comments for complex or critical parts.
  • Updated the documentation in the /docs/ directory for Fiber's documentation.
  • Added or updated unit tests to validate the effectiveness of the changes or new features.
  • Ensured that new and existing unit tests pass locally with the changes.
  • Verified that any new dependencies are essential and have been agreed upon by the maintainers/community.
  • Aimed for optimal performance with minimal allocations in the new code.
  • Provided benchmarks for the new code to analyze and improve upon.

@loderunner loderunner requested a review from a team as a code owner March 1, 2026 11:06
@ReneWerner87 ReneWerner87 added the v3 label Mar 1, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 1, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds a typed BindError with Source and Field, exported BindSource* constants, constructor and wrapping helpers; binding methods now return *BindError in manual mode (or preserve existing *Error in auto mode). Tests and docs updated; parseToStruct no longer prefixes errors with "bind: ".

Changes

Cohort / File(s) Summary
Core BindError Implementation
bind.go
Adds exported BindError struct (Error()/Unwrap()), BindSource* constants, newBindError() and returnBindErr() helpers; binding entry points (Header, RespHeader, Cookie, Query, JSON, CBOR, XML, Form, URI, MsgPack, Body, All) route decode failures as *BindError in manual mode while preserving existing auto-handler behavior.
Binding Tests
bind_test.go
Adds and updates tests to assert BindError unwrapping, field extraction, and source propagation; replaces many direct string checks with errors.As/errors.Is and updates expected messages to the new format.
Binder mapping
binder/mapping.go
parseToStruct stops prefixing returned errors with "bind: ", returning underlying decoder errors unchanged.
Mapping Tests
binder/mapping_test.go
Updates expected error message in Test_parseToStruct_MismatchedData to reflect removal of the "bind: " prefix.
Documentation
docs/api/bind.md
Adds BindError documentation and examples (manual vs automatic handling, errors.As usage), lists BindSource* constants, clarifies binding vs validation semantics, and fixes minor formatting issues.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client
    participant Handler as Handler
    participant Binder as Binder
    participant Decoder as Decoder

    Client->>Handler: HTTP request
    Handler->>Binder: Bind().All(&target)
    Binder->>Decoder: Decode URI
    Decoder-->>Binder: success / error
    alt URI error
        Binder->>Binder: wrap -> BindError{Source: "uri", Field: ...}
        Binder-->>Handler: *BindError
    else URI success
        Binder->>Decoder: Decode Body
        Decoder-->>Binder: success / error
        alt Body error
            Binder->>Binder: wrap -> BindError{Source: "body", Field: ...}
            Binder-->>Handler: *BindError
        else Body success
            Binder->>Decoder: Decode Query/Header/Cookie...
            Decoder-->>Binder: success / error
            alt any error
                Binder->>Binder: wrap -> BindError{Source: "...", Field: ...}
                Binder-->>Handler: *BindError
            else
                Binder-->>Handler: nil (bound)
            end
        end
    end
    Handler-->>Client: response (may inspect BindError via errors.As)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

✏️ Feature

Suggested reviewers

  • gaby
  • sixcolors
  • efectn
  • ReneWerner87

Poem

🐰 I hopped through fields and found the source,
I wrapped the error, trimmed the remorse.
"uri" or "body", the field now clear,
Inspect with As and handle near.
A little hop, a tidy cheer — rejoice, devs, and grab a carrot here! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 63.16% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'add BindError type with source and field metadata' clearly and specifically describes the main change: introducing a new BindError type with structured error metadata.
Description check ✅ Passed The PR description comprehensively covers purpose, linked issue, changes introduced, breaking changes, migration guide, documentation updates, and testing checklist per the template.
Linked Issues check ✅ Passed The PR implements all core requirements from issue #4118: BindError type with Source/Field metadata, proper Unwrap() implementation for error chain traversal, all bind methods returning *BindError on failure, and correct HTTP status semantics.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the BindError feature: bind.go, bind_test.go, binder/mapping.go, binder/mapping_test.go, and docs/api/bind.md align with the stated objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ReneWerner87 ReneWerner87 added this to v3 Mar 1, 2026
@ReneWerner87 ReneWerner87 added this to the v3 milestone Mar 1, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves error handling for data binding operations by introducing a new BindError type. This structured error allows developers to programmatically identify the exact source and field that caused a binding failure, enabling more precise and context-aware error responses. The change facilitates better adherence to RFC standards for HTTP error codes and enhances the overall robustness of application error management.

Highlights

  • Structured Binding Errors: Introduced a new *fiber.BindError type that provides structured information about binding failures, including the Source (e.g., URI, query, body) and Field (the specific struct field or tag key that failed).
  • Enhanced Error Handling: All Bind() methods now return *BindError on parse failure, allowing callers to use errors.As to extract detailed error context and implement more granular error handling logic.
  • Error Message Format Change: Modified the format of error strings: the 'bind: ' prefix was removed from schema errors, and new structured error messages are generated by BindError (e.g., bind "field" from source: underlying error).
  • Documentation Update: Added a dedicated section in the documentation for BindError, explaining its structure, source constants, how to branch on error sources, and clarifying the distinction between validation and binding errors.
Changelog
  • bind.go
    • Imported encoding/json, errors, fmt, and github.com/gofiber/schema.
    • Added BindError source constants (e.g., BindSourceURI, BindSourceQuery).
    • Defined the BindError struct with Err, Source, and Field fields.
    • Implemented Error() and Unwrap() methods for BindError to support error chaining.
    • Added extractFieldFromError function to extract field names from various underlying error types.
    • Added newBindError helper function to create BindError instances.
    • Updated comments for the Bind struct and its methods to reflect the new *BindError return type.
    • Modified all Bind methods (Header, RespHeader, Cookie, Query, JSON, CBOR, XML, Form, URI, MsgPack, Body, All) to wrap binding errors in *BindError unless they are already *fiber.Error.
  • bind_test.go
    • Added Test_BindError_Unwrap to verify errors.Is and errors.As functionality with BindError.
    • Added Test_BindError_FieldExtraction to test the correct extraction of field names from schema.ConversionError and json.UnmarshalTypeError.
    • Added Test_BindError_Sources to confirm that BindError.Source correctly identifies the origin of binding failures (URI, Query, Header, Cookie, Body).
    • Added Test_BindError_All to ensure BindError is properly returned when using the All binding method.
    • Updated existing tests (Test_Bind_Query, Test_Bind_Query_Schema, Test_Bind_Header, Test_Bind_Header_Schema, Test_Bind_RespHeader, Test_Bind_Cookie, Test_Bind_Cookie_Schema, Test_Bind_WithAutoHandling) to assert against the new BindError type and its structured error message format.
  • binder/mapping.go
    • Modified parseToStruct to remove the redundant 'bind: ' prefix from schema error messages.
  • binder/mapping_test.go
    • Updated Test_parseToStruct_MismatchedData to reflect the change in error message format by removing the 'bind: ' prefix.
  • docs/api/bind.md
    • Updated code block syntax from go title="Example" to go title="Example" for consistency.
    • Corrected table formatting for array values in query parameters.
    • Added a new 'BindError' section detailing the BindError struct, its source constants, an example of branching on Source, and clarifying the distinction between validation and binding errors.
Activity
  • A new feature, BindError, has been introduced to provide structured error details for binding failures.
  • Existing binding methods have been updated to integrate the new BindError type.
  • Comprehensive unit tests have been added to validate the functionality and behavior of BindError.
  • The official documentation has been updated to guide users on how to leverage the new structured error handling.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant improvement by adding the BindError type, which provides structured error information for binding failures. This change enhances error handling capabilities for developers using Fiber. The implementation is well-executed, with comprehensive test coverage and updated documentation. My main feedback is to consider refactoring the duplicated error-wrapping logic in the various Bind methods into a shared helper function to improve code maintainability.

Comment thread bind.go Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (2)
binder/mapping.go (1)

120-120: Avoid re-wrapping the decode error in parseToStruct.

Line 120 wraps the same error with fmt.Errorf("%w", err). Returning err directly avoids an unnecessary wrapper and keeps the original error as the top-level value.

♻️ Suggested change
-		return fmt.Errorf("%w", err)
+		return err
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@binder/mapping.go` at line 120, The function parseToStruct currently re-wraps
the decode error by returning fmt.Errorf("%w", err); change this to return the
original err directly (i.e., return err) so the original error value and its
type are preserved; locate the return inside parseToStruct where
fmt.Errorf("%w", err) is used and replace it with returning err without
additional wrapping.
bind.go (1)

220-225: Extract the repeated parse-error wrapping block into a helper.

The same errors.As(..., *Error) + newBindError(source, err) pattern is repeated across all bind methods. A shared helper would reduce duplication and keep behavior consistent.

Also applies to: 239-245, 259-265, 278-284, 297-303, 316-322, 334-340, 355-361, 373-379, 392-398, 418-424

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bind.go` around lines 220 - 225, Extract the repeated pattern that checks
errors.As(err, &Error) and returns either the original error or
newBindError(source, err) into a helper method on the binder (e.g., func (b
*binder) wrapParseError(err error, source BindSource) error) and replace the
inline blocks (currently surrounding calls like
b.returnErr(bind.Bind(b.ctx.Request(), out))) with calls to that helper; the
helper should accept the parse error, use errors.As to detect *Error and return
it unchanged, otherwise return newBindError(source, err), and update all
occurrences that currently use BindSourceHeader and other BindSource constants
to call this new method.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@bind_test.go`:
- Around line 114-121: The test handler registered with app.Get("/user/:id")
uses require.* assertions inside the route handler (calling require.Error,
require.ErrorAs, require.Equal), which the linter forbids; change those
in-handler assertions to use the testing.T methods (e.g., t.Fatalf/t.Errorf) or
capture the error/state to assert outside the handler: when calling
ctx.Bind().URI(new(U)) handle the returned err by using t.Fatalf/t.Errorf and
check error types (BindError, BindSourceURI, MultiError) via t.Errorf or
t.Fatalf inside the handler, or store err in a shared variable/channel and
perform require.* assertions after invoking the handler in the test body
instead.
- Around line 67-184: The failing tests call t.Parallel() inside subtests while
reusing the same app and Ctx (variables app and c obtained via
app.AcquireCtx(...)), causing races; fix by creating a fresh app and context per
subtest (move New() and app.AcquireCtx(...) into each t.Run closure) or remove
t.Parallel() from those subtests so each uses the shared c safely; update
references in Test_BindError_FieldExtraction and Test_BindError_Sources to
instantiate new app/ctx (or drop parallelization) before mutating c.Request(),
app.Get(...), or calling Bind().*.

In `@bind.go`:
- Around line 418-426: In Body(), after successfully calling the custom binder's
Parse via b.returnErr(customBinder.Parse(b.ctx, out)), run the same
StructValidator path used for built-in body binders: if b.StructValidator != nil
call b.StructValidator.Validate(out) (or the project's validator entrypoint) and
handle errors the same way (wrap/return as newBindError(BindSourceBody, err)
unless it's already a *Error via errors.As), instead of returning nil
immediately; this ensures customBinder.Parse(...) is followed by validation for
consistency with built-in binders.

In `@docs/api/bind.md`:
- Around line 689-690: Update the BindError paragraph to clarify that BindError
is returned only when manual handling is used and that in auto-handling mode
(WithAutoHandling) parse failures are converted to *fiber.Error (HTTP 400);
explicitly state that errors.As should be used to extract *BindError only when
not using WithAutoHandling, and that callers using automatic handling should
instead check for *fiber.Error or HTTP 400 status. Reference the BindError type
and the WithAutoHandling option in the updated sentence to make the distinction
explicit.

---

Nitpick comments:
In `@bind.go`:
- Around line 220-225: Extract the repeated pattern that checks errors.As(err,
&Error) and returns either the original error or newBindError(source, err) into
a helper method on the binder (e.g., func (b *binder) wrapParseError(err error,
source BindSource) error) and replace the inline blocks (currently surrounding
calls like b.returnErr(bind.Bind(b.ctx.Request(), out))) with calls to that
helper; the helper should accept the parse error, use errors.As to detect *Error
and return it unchanged, otherwise return newBindError(source, err), and update
all occurrences that currently use BindSourceHeader and other BindSource
constants to call this new method.

In `@binder/mapping.go`:
- Line 120: The function parseToStruct currently re-wraps the decode error by
returning fmt.Errorf("%w", err); change this to return the original err directly
(i.e., return err) so the original error value and its type are preserved;
locate the return inside parseToStruct where fmt.Errorf("%w", err) is used and
replace it with returning err without additional wrapping.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b660ce8 and 019d202.

📒 Files selected for processing (5)
  • bind.go
  • bind_test.go
  • binder/mapping.go
  • binder/mapping_test.go
  • docs/api/bind.md

Comment thread bind_test.go Outdated
Comment thread bind_test.go
Comment thread bind.go Outdated
Comment thread docs/api/bind.md Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 1, 2026

Codecov Report

❌ Patch coverage is 97.82609% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.07%. Comparing base (f137bf0) to head (9e285b9).
⚠️ Report is 240 commits behind head on main.

Files with missing lines Patch % Lines
bind.go 97.77% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4120      +/-   ##
==========================================
+ Coverage   91.04%   91.07%   +0.03%     
==========================================
  Files         119      119              
  Lines       11344    11377      +33     
==========================================
+ Hits        10328    10362      +34     
- Misses        644      645       +1     
+ Partials      372      370       -2     
Flag Coverage Δ
unittests 91.07% <97.82%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
docs/api/bind.md (1)

705-717: Consider adding import context to the example.

The example demonstrates errors.As usage correctly, but doesn't show the required imports (errors, github.com/google/uuid) or explicitly state it assumes manual handling mode (not using WithAutoHandling). Consider adding a brief comment to clarify the handling mode.

📝 Suggested enhancement
+// Example (assumes manual handling mode - not using WithAutoHandling)
+// Required imports: "errors" and "github.com/google/uuid"
 var req struct {
     ID   uuid.UUID `uri:"id"`
     Name string    `json:"name"`
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/api/bind.md` around lines 705 - 717, Update the example to show required
imports and clarify manual handling: add mentions/imports for "errors" and
"github.com/google/uuid" and a short comment above the snippet stating this
example assumes manual error handling (not using WithAutoHandling). Also ensure
the example references the same symbols used in the text (Bind().All,
fiber.BindError, fiber.BindSourceURI) so readers can match the imports and
handling mode to the code.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/api/bind.md`:
- Around line 687-722: The markdown in docs/api/bind.md needs to be linted; run
the project's markdown lint step by executing the Make target (run "make
markdown") locally and fix any reported issues in docs/api/bind.md (e.g.,
headings, code block fences, spacing) until the linter passes; then re-run "make
markdown" to confirm and update the commit.

---

Nitpick comments:
In `@docs/api/bind.md`:
- Around line 705-717: Update the example to show required imports and clarify
manual handling: add mentions/imports for "errors" and "github.com/google/uuid"
and a short comment above the snippet stating this example assumes manual error
handling (not using WithAutoHandling). Also ensure the example references the
same symbols used in the text (Bind().All, fiber.BindError, fiber.BindSourceURI)
so readers can match the imports and handling mode to the code.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 56ee103 and f3c1e82.

📒 Files selected for processing (1)
  • docs/api/bind.md

Comment thread docs/api/bind.md
@ReneWerner87
Copy link
Copy Markdown
Member

@loderunner thx for the PR
can you check the AI review hints

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@bind.go`:
- Around line 171-177: In returnBindErr, avoid using errors.As which matches
wrapped *Error values; instead perform a top-level type check (type assertion)
on retErr to see if it is *Error so wrapped fiber errors are not treated as raw
*Error in manual mode (WithoutAutoHandling). Also pass the transformed retErr
(not the original err) into newBindError when creating a *BindError. Update the
logic in returnBindErr to use a direct type assertion against *Error (and return
retErr if it truly is that concrete type) and call newBindError(source, retErr)
otherwise.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f3c1e82 and 99570f8.

📒 Files selected for processing (2)
  • bind.go
  • docs/api/bind.md

Comment thread bind.go Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@bind.go`:
- Around line 180-182: There is a stray block after the returnBindErr function
that adds an extra closing brace, a dangling "return nil", and another brace
which breaks compilation; remove the extraneous "}", "return nil", and final "}"
following the returnBindErr function so the function ends cleanly (locate
returnBindErr in bind.go and delete the stray block immediately after its
closing brace).

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 99570f8 and 4db0f4e.

📒 Files selected for processing (1)
  • bind.go

Comment thread bind.go Outdated
@loderunner
Copy link
Copy Markdown
Contributor Author

@ReneWerner87 I think I've adressed all AI comments. Good to merge?

@ReneWerner87 ReneWerner87 merged commit 5818d9a into gofiber:main Mar 2, 2026
21 checks passed
@github-project-automation github-project-automation Bot moved this to Done in v3 Mar 2, 2026
@welcome
Copy link
Copy Markdown

welcome Bot commented Mar 2, 2026

Congrats on merging your first pull request! 🎉 We here at Fiber are proud of you! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

📝 [Proposal]: Typed binding errors with source and field information

3 participants