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

fix rest client reactive exception handling guide #1437

Closed
wants to merge 1 commit into from
Closed

fix rest client reactive exception handling guide #1437

wants to merge 1 commit into from

Conversation

felipewind
Copy link
Contributor

@felipewind felipewind commented May 20, 2022

I believe that:

  • The implementation of ResponseExceptionMapper should be done by a class and not an interface.
  • The method toThrowable should be public, or I receive this error: Cannot reduce the visibility of the inherited method from ResponseExceptionMapper<RuntimeException>

Current version

public interface MyResponseExceptionMapper implements ResponseExceptionMapper<RuntimeException> {

    RuntimeException toThrowable(Response response) {
        if (response.getStatus() == 500) {
            throw new RuntimeException("The remote service responded with HTTP 500");
        }
        return null;
    }
}

Proposed version

public class MyResponseExceptionMapper implements ResponseExceptionMapper<RuntimeException> {

    @Override
    public RuntimeException toThrowable(Response response) {
        if (response.getStatus() == 500) {
            throw new RuntimeException("The remote service responded with HTTP 500");
        }
        return null;
    }
}

@gsmet
Copy link
Member

gsmet commented May 21, 2022

Hi @felipewind .

Thanks for this but changes to the guides need to be done there: https://github.com/quarkusio/quarkus/tree/main/docs/src/main/asciidoc .

Once it's in the main repo, I'll merge your PR though as fixing old branches is a good idea.

@felipewind
Copy link
Contributor Author

felipewind commented May 21, 2022

Hello @gsmet .

Sorry about the mistake.

I sent the PR as you asked:

Please tell me if I must change anything.

Thanks

@gastaldi gastaldi closed this May 22, 2022
@gastaldi
Copy link
Collaborator

Thank you! Closing this now

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.

3 participants