简体   繁体   中英

I wan to send exception message from one quarkus service and another quarkus service. How do I do that?

I have two services, If any exception is thrown is one service I should be able to receive that exception is other service which is making the call to that service. In short I want to communicate the exception body from one service to another.

Currently the exception response is: Received: 'Server response is: 500' when invoking: Rest Client method: 'XXX' regardless of whatever the exception message is thrown.

I want the exception message message to be communicated to the calling services.

Solution but not conventional: The Error message I am currently sending throw headers, The exception body is not picked.

From your service1 you send Response with any http status you want. At your service2 to while writing client you need to catch WebApplicationException to know what status returned by service1 client.

[Optional] You can use org.eclipse.microprofile.rest.client.ext.ResponseExceptionMapper to map http response status to your custom exceptions at your service2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM