[jira] [Commented] (OFBIZ-10692) Groovy DSL runService Exception Management

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-10692) Groovy DSL runService Exception Management

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-10692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16730302#comment-16730302 ]

Gil Portenseigne commented on OFBIZ-10692:
------------------------------------------

Hello [~mleila],

Thanks for your contribution, i just review it.

‘ExecutionServiceException’ is indeed not only an extend of ‘GeneralException’, but more precisely an extend of ‘GenericServiceException’ for Groovy DSL to manage error during DSL execution.

 

About the :
{code:java}
 // When throwing ExecutionServiceException in Groovy DSL runService method
 // since we are dependent on Groovy MetaClassImpl that throws InvokerInvocationException
 // we need to check nested exception to only throw the embedded service error message.
 Throwable nested = e.getCause();
 if (nested instanceof ExecutionServiceException) {
     throw new ExecutionServiceException(nested.getMessage());
 }
 {code}
I see no other way to detect ‘ExecutionServiceException’, since it is effectively embed within another exception by groovy itself.

 

The test is ok, i'll commit that in the next days letting some time for more reviews.

 

It's nice that with this improvement while running run service DSL, we won't need anymore to write down
{code:java}
if (ServiceUtil.isError(returnMap)) return returnMap{code}

> Groovy DSL runService Exception Management
> ------------------------------------------
>
>                 Key: OFBIZ-10692
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-10692
>             Project: OFBiz
>          Issue Type: Improvement
>    Affects Versions: Trunk
>            Reporter: Leila Mekika
>            Assignee: Gil Portenseigne
>            Priority: Minor
>              Labels: patch
>         Attachments: OFBIZ-10692-TEST.patch, OFBIZ-10692.patch
>
>
> Like discussed in thread : [https://lists.apache.org/thread.html/5a8e1caed0bcf29889c6b88ec1916947cf092d6f99d7dfe27cbef8c0@%3Cdev.ofbiz.apache.org%3E]
>   
>  This ticket try to improve the way that errors are rendered when using \{run service} groovy DSL method.
>  
>  To reproduce and test patch:
>  apply the attached patch [^OFBIZ-10692-TEST.patch] (it adds a control on createUomConversionDated service) and try to create a conversion rate with a fromDate greater than the thruDate here:
>  [https://localhost:8443/accounting/control/viewFXConversions?organizationPartyId=Company]
>   
>  You should then see the following error:
>      The Following Errors Occurred: Error calling event: org.apache.ofbiz.webapp.event.EventHandlerException: Service invocation error (org.apache.ofbiz.service.ExecutionServiceException: Through date can't be same or smaller than from date)
>   
>  With OFBIZ-10692.patch update, the error must be displayed like:
>      The Following Errors Occurred: Through date can't be same or smaller than from date
>   



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)