selendroid/selendroid — pull request #562 by ainsej (2014-09-02 16:13:44+00:00)
Title: Cleaned up repetitive error handling in selendroid-server

Sorry for the diff on this one - no functional changes just code cleanup.

Introduced a StatusCode enum to make the SelendroidResponse constructors clearer, also made the integer constructors private to prevent their usage in future.

Also centralised all of the exception handling (StaleElements/ElementNotFound/UnknownError) into a single method handle() in SafeRequestHandler. All child classes of SafeRequestHandler have to implement safeHandle, which has all of it's exceptions handled and converted into SelendroidResponses by it's parent.

This means that we don't need all of the repetitive error handling in all of the handlers and they can be written more "naturally"

Submitted on behalf of: Facebook