quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.4k stars 2.57k forks source link

Guide for error handling #14067

Open cervenf opened 3 years ago

cervenf commented 3 years ago

Description Could you please add guide for "best practices" for error handling?

I have microservice A which fetch and process data from external service B via rest client (jax rs). Processed data are fetch by microservice C. How should be error handled on each step ? (rest client in A, in service A, rest client in C ?)

I think best would be to go with json response in this case, something like rfc7807, for example: { "type": "https://example.org/out-of-stock", "title": "Out of Stock", "status": 400, "detail": "Item B00027Y5QG is no longer available", "product": "B00027Y5QG" }

In spring boot there is resttemplate error handling, then also @RestControllerAdvice (which seems to be available also in quarkus), https://github.com/zalando/problem-spring-web

But not sure what is the best way for quarkus. Thank you.

lwitkowski commented 3 years ago

Hi @ferinoc, I think you might be interested in this extension: https://github.com/TietoEVRY/quarkus-resteasy-problem

Would be great to get some feedback, we're still working on it, but it's pretty stable already, and I personally think it's the best way for quarkus, but my opinion may be biased ;)

mhagnumdw commented 1 year ago

Hi @ferinoc, I think you might be interested in this extension: https://github.com/TietoEVRY/quarkus-resteasy-problem

Would be great to get some feedback, we're still working on it, but it's pretty stable already, and I personally think it's the best way for quarkus, but my opinion may be biased ;)

Thanks! I liked it and I'm already using it.

quarkus-bot[bot] commented 1 year ago

/cc @FroMage, @MichalMaler, @ebullient, @geoand, @hmanwani-rh, @inoxx03, @michelle-purcell, @sheilamjones, @stuartwdouglas, @sunayna15

geoand commented 1 year ago

@lwitkowski I think that adding your extension to the Quarkiverse would be great. What do you think?

lwitkowski commented 1 year ago

@geoand I think it is a great idea, and that would make my life a lot easier (no need to keep compatibility with 13 different quarkus versions ;)), but this decision is not entirely up to me. I'll try to pull some strings again in Tietoevry to make it happen. Quarkus 3 seems like a good reason to have another conversation about it.

geoand commented 1 year ago

👍🏼

cc @gastaldi