Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gin server custom error handler option #587

Merged

Conversation

chaseisabelle
Copy link
Contributor

@chaseisabelle chaseisabelle commented May 21, 2022

allows for a custom error handler option to the gin server code generation. default/existing behavior is preserved.

i really want my employer to use this tool going forward, but gin is a requirement, and is custom error handling.

Closes: #584.

@jxsl13
Copy link

jxsl13 commented May 21, 2022

bool return value vs error return value?

@chaseisabelle
Copy link
Contributor Author

Well, the error is what the handler is handling, so it seems superfluous to return it back to the caller. Or am I misunderstanding what you mean?

@chase-isabelle-roostify

@deepmap-marcinr @jxsl13 Hey, all. Just a friendly checkup. Any update on this?

@jxsl13
Copy link

jxsl13 commented May 24, 2022

I just had the thought that it might (or might not) make sense to return error values from the error handler in order to do whatever one wants to do with them, log, report, send somewhere, etc.

It's more or less a discussion topic, I'd guess that maybe someone might have a use case for returning an error instead of a bool.

If not, bool is fine.

@chaseisabelle
Copy link
Contributor Author

@deepmap-marcinr Sorry to bug ya. Was just wondering if these changes might be good to go?

@deepmap-marcinr
Copy link
Contributor

deepmap-marcinr commented May 27, 2022 via email

@chaseisabelle
Copy link
Contributor Author

I've managed to mitigate this with custom templates: https://github.com/deepmap/oapi-codegen#making-changes-to-code-generation

@jeroendk
Copy link
Contributor

It would be nice if this gets implemented... What is holding it back atm?
Mitigating it with custom templates is suboptimal and without all the built-in errors returns a different format than the spec that is loaded...

Let me know if I can help out.

@deepmap-marcinr
Copy link
Contributor

I've been super busy and not putting much work into oapi-codegen recently. All this needs is to have the conflict resolved. I'll see if I can have a look a little later today.

chaseisabelle and others added 4 commits October 27, 2022 10:19
This pull request has been in the queue for a long time, and
diverged a lot. Fix various issues related to that.
@deepmap-marcinr deepmap-marcinr merged commit d74c88f into deepmap:master Oct 27, 2022
@jeroendk
Copy link
Contributor

Awesome, thanks!

adrianpk pushed a commit to foorester/oapi-codegen that referenced this pull request Jan 16, 2024
* gin server custom error handler option

* removed bool return

* ran make gen

* Fix various issues from rebasing against master

This pull request has been in the queue for a long time, and
diverged a lot. Fix various issues related to that.

Co-authored-by: marcinromaszewicz <marcinromaszewicz@deepmap.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gin server append error with c.Error() instead of dumping it with c.JSON()
5 participants