-
Notifications
You must be signed in to change notification settings - Fork 34
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
Better message needed prompting admin to setup Remote Site Setting for ApexUML #6
Comments
Ha, we can indeed and will! 👍 |
@afawcett - What is your opinion about more exception classes in the ToolingAPI class? I am working on this ticket now. Basically, it will be solved by wrapping the http.send() call in the submitRestCall(String, String, Object) method with a try catch block which will catch a System.CalloutException. Currently, the ToolingAPI class has a single exception (ToolingAPIException). The ToolingAPIException has a distinct "purpose." It supports relaying error codes from the tooling api but it does not really support the concept of errors within the ToolingAPI Apex class and, as with this case, communication errors prior to reaching the SFDC Tooling API endpoint. I am reluctant to use this ToolingAPIException class as the exception to be thrown here for this issue. It does not convey the errors from the SFDC Tooling API methods; it is instead a CalloutException. My reluctance comes from trying to get the ToolingAPI consumer Apex class to interpret what the exception is regarding. In this situation, the ToolingAPIException would not have ErrorResponse records. In general, I see a potential need to segment out the exception types for the ToolingAPI class in one of three manners:
What are your thoughts about these options? @dancinllama, do you have any thoughts about this discussion? |
Temporarily am trapping the CalloutException in the ToolingAPI and throwing a ToolingAPIException. The UmlService is now trapping the ToolingAPI.ToolingAPIException in certain places and creates a new UmlServiceException to throw to the client tier (i.e. UmlController). This is a temporary solution until the debate about expanding the ToolingAPI.ToolingAPIException (see comments on this issue) is concluded. These changes should remain on this branch until debate is comcluded.
I like option 1, it's OO and the way exceptions should work, catching an exception then inspecting an enum or expecting the call to do some work is not nice. Though since all exceptions extend Exception if the caller is simply not interested they can catch this as well, and all we need to do is ensure all our exception types honour the base class needs to provide a reasonable message. So i am in favour of having another exception class basically, option 1. 👍 |
John, after a brief conflab with co-contributor James, it was a no brainer, your now a committer, it makes sense as the Tooling API and Apex UML are somewhat developing together. And I've been keeping both in sync as a commit into Apex UML and then into Tooling API to avoid divergence (must go see that film!). |
Ah. Very cool! Thank you both for that. Cheers! cc: @dancinllama |
ToolingAPI * added ToolingAPIAuthorizationException * submitRestCall(string, string, Object) method now throws ToolingAPIAuthorizationException if a CalloutException occurs where the endpoint is not authorized. UmlService * reorganized methods so that private methods appear first then public and all methods are sorted alphabetically. * added new makeException(ToolingApi.ToolingAPIAuthorizationException) method to handle endpoint authorization issues. * other methods updated to make use of new makeException method * spaced some of the methods out some for readability.
This has been included in v1.7. |
When ApexUML is installed, the usual experience is that the admin forgets to add a Remote Site Setting record to allow ApexUML to utilize the connection to the ToolingAPI. (I know I keep forgetting). Right now the exception comes back as very convoluted and is not a "user friendly" message explaining what needs to be done. We can do better!!! ;-)
The text was updated successfully, but these errors were encountered: