Conversation
Resolve conflict in strict-gin.tmpl: combine error handler function (from PR) with optional body handling (from upstream). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Ok, so I know what to do here. I'm going to have three categories of error callbacks.
The problem with having a single callback, is that you have no idea where it was called from, so you don't have good context on how to handle that error. With these three error handler types, I think we can retain current behavior (which this PR breaks without @jamietanna 's changes) and allow for much easier error customization. |
…ict gin template Split the single ErrorHandlerFunc into three distinct callbacks to give callers control over error responses by category: - RequestErrorHandlerFunc: request parsing/binding errors (default 400) - HandlerErrorFunc: application handler errors (default 500) - ResponseErrorHandlerFunc: response serialization errors (default 500) This also fixes two bugs in the original template: - Missing multipart boundary now passes http.ErrMissingBoundary instead of a nil error - Unexpected response type now passes a descriptive error instead of nil Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Greptile SummaryThis PR adds configurable error handling to the strict Gin server by introducing a Key changes:
Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| pkg/codegen/templates/strict/strict-gin.tmpl | Adds StrictGinServerOptions struct and NewStrictHandlerWithOptions constructor, wiring all error paths through configurable handler functions with nil-safe defaults. Logic is correct, nil-checks are present, and the if-else chain correctly prevents double-writes. |
Last reviewed commit: d2d8b62
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
I accepted a Greptile code fix, but this affected generated code.
Strict gin server doesn't currently use an error handler function. This adds the error handler to the strict gin handler