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

Pass RPC handler exceptions to error handler #4529

Merged
merged 2 commits into from Aug 31, 2018

Conversation

Artur-
Copy link
Member

@Artur- Artur- commented Aug 15, 2018

Fixes #801


This change is Reviewable

Copy link
Contributor

@denis-anisimov denis-anisimov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r1.
Reviewable status: 1 unresolved discussion, 0 of 1 LGTMs obtained

a discussion (no related file):
ServerRpcHandler is just one of the handlers.

It's used by UidlRequestHandler which is SynchronizedRequestHandler.
All request handlers are invoked in the VaadinService::handleRequest() method.
So shouldn't we instead catch the exception in a generic way for every request handler in the VaadinService instead of personal catching inside a ServerRpcHandler (and may be a number of other different handlers)?


Copy link
Member Author

@Artur- Artur- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 unresolved discussion, 0 of 1 LGTMs obtained

a discussion (no related file):

Previously, denis-anisimov (Denis) wrote…

ServerRpcHandler is just one of the handlers.

It's used by UidlRequestHandler which is SynchronizedRequestHandler.
All request handlers are invoked in the VaadinService::handleRequest() method.
So shouldn't we instead catch the exception in a generic way for every request handler in the VaadinService instead of personal catching inside a ServerRpcHandler (and may be a number of other different handlers)?

This is consistent with how FW8 works, wrapping each RPC handler in a separate try-catch block to continue handling other RPCs even though the first might fail. There is a generic handler in VaadinService, that's the one which says "internal error" if nobody else handled the problem. "Internal error" does make sense if this was thrown from some Flow method


Copy link
Contributor

@denis-anisimov denis-anisimov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 unresolved discussion, 0 of 1 LGTMs obtained

a discussion (no related file):

Previously, Artur- (Artur) wrote…

This is consistent with how FW8 works, wrapping each RPC handler in a separate try-catch block to continue handling other RPCs even though the first might fail. There is a generic handler in VaadinService, that's the one which says "internal error" if nobody else handled the problem. "Internal error" does make sense if this was thrown from some Flow method

No problem with wrapping each RPC handler in a separate try-catch block.

The question is :
should it be

for (RequestHandler handler : getRequestHandlers()) {
     try {
                if (handler.handleRequest(vaadinSession, request, response)) {
                    return;
                }
            }
    }
   catch(Exception e){

      // PROPER EXCEPTION HANDING HERE
   }

instead of having the same code all over every personal handler deep inside as it's done in this PR?


Copy link
Member Author

@Artur- Artur- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 unresolved discussion, 0 of 1 LGTMs obtained

a discussion (no related file):

Previously, denis-anisimov (Denis) wrote…

No problem with wrapping each RPC handler in a separate try-catch block.

The question is :
should it be

for (RequestHandler handler : getRequestHandlers()) {
     try {
                if (handler.handleRequest(vaadinSession, request, response)) {
                    return;
                }
            }
    }
   catch(Exception e){

      // PROPER EXCEPTION HANDING HERE
   }

instead of having the same code all over every personal handler deep inside as it's done in this PR?

There can be multiple RPC calls inside one request, right? If so, then wrapping the whole request handler would behave differently (remaining RPCs not invoked)


Copy link
Contributor

@denis-anisimov denis-anisimov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: all discussions resolved, 0 of 1 LGTMs obtained, and 1 stale

a discussion (no related file):

Previously, Artur- (Artur) wrote…

There can be multiple RPC calls inside one request, right? If so, then wrapping the whole request handler would behave differently (remaining RPCs not invoked)

Right.


@Artur- Artur- force-pushed the _rpc-errors-to-error-handler branch from 693236b to 2480771 Compare August 29, 2018 18:40
@vaadin-bot
Copy link
Collaborator

SonarQube analysis reported 1 issue

Note: The following issues were found on lines that were not modified in the pull request. Because these issues can't be reported as line comments, they are summarized here:

  1. MINOR ServerRpcHandler.java#L404: Move this method into "RpcRequest". rule

Copy link
Contributor

@caalador caalador left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r2, 1 of 1 files at r3.
Reviewable status: all discussions resolved, 0 of 1 LGTMs obtained, and 2 stale

@caalador caalador merged commit 58deb30 into vaadin:master Aug 31, 2018
@pekam pekam added this to the 1.1.0.beta3 milestone Sep 5, 2018
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.

None yet

5 participants