You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Jacques Le Roux (JIRA)" <ji...@apache.org> on 2018/01/01 13:50:00 UTC

[jira] [Commented] (OFBIZ-9981) Handle service response effectively

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

Jacques Le Roux commented on OFBIZ-9981:
----------------------------------------

I Suraj,

As you may know I have decided to review each change again. This will be a long and large task.

To begin here is a question not only for you, who provided the content patch, but for all the community. In ContentPermissionServices we have this pattern (I guess we can find it elsewhere)
{code}
        try {
            permResults = dispatcher.runSync("checkContentPermission", serviceInMap);
            if (ServiceUtil.isError(permResults)) {
                return ServiceUtil.returnError(ServiceUtil.getErrorMessage(permResults));
            }
        } catch (GenericServiceException e) {
            Debug.logError(e, "Problem checking permissions", "ContentServices");
        }
{code}
So it was previously decided that in case of GenericServiceException logging an error was enough. You decided that in case of error in the checkContentPermission service the checkAssocPermission calling service should return an error with an error message. I tend to agree with you. But then we are inconsistent because it seems to me that a GenericServiceException should also return an error with an error message.

This is the kind of pattern that we can generalise and we (the community) should agree about.


> Handle service response effectively
> -----------------------------------
>
>                 Key: OFBIZ-9981
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-9981
>             Project: OFBiz
>          Issue Type: Improvement
>            Reporter: Suraj Khurana
>            Assignee: Jacques Le Roux
>         Attachments: OFBIZ-9981-MAR-SECEXT-WE.patch, OFBIZ-9981-content.patch, OFBIZ-9981-manufacturing.patch, OFBIZ-9981-order.patch, OFBIZ-9981-party.patch, OFBIZ-9981-plugins.patch, OFBIZ-9981-product.patch, OFBIZ-9981.patch
>
>
> [As per discussion on Dev ML|http://markmail.org/message/dfriai337uxlx5mo]: 
> ==========================
> Every service calling from java/groovy must handle errors by service util methods such as isError, reutrnError etc. and similarly in case of XML <call-service, there should be <check-error/> to make sure service was executed successfully.
> Apart from this, one suggestion is to include *Debug.logError* in *_ServiceUtil.returnProblem_* so that in case of any error occurred and handled, it will always be logged on the console.
> ==========================



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)