You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stratos.apache.org by Lahiru Sandaruwan <la...@wso2.com> on 2015/05/08 04:35:52 UTC

Shall we get rid of "StratosUserManagerUtils"

Hi all,

It seems $subject is possible. We wrap real exceptions
with UserManagerException in this class. IMO this is not correct way of
handling exceptions.

As a result of this, it returns wrong response.

E.g. Removing non existing user returns "Could not delete user: sd", but it
should return that user does not exist.

stratos>  remove-user sd
Could not delete user: sd

Correct way is to let the "StratosApiV41" class handle all the specific
exceptions and return correct status code with message.

Wdyt?

Thanks.
-- 
--
Lahiru Sandaruwan
Committer and PMC member, Apache Stratos,
Senior Software Engineer,
WSO2 Inc., http://wso2.com
lean.enterprise.middleware

phone: +94773325954
email: lahirus@wso2.com blog: http://lahiruwrites.blogspot.com/
linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146

Re: Shall we get rid of "StratosUserManagerUtils"

Posted by Lahiru Sandaruwan <la...@wso2.com>.
Thanks Chamila!

On Fri, May 8, 2015 at 8:23 AM, Chamila De Alwis <ch...@wso2.com> wrote:

> The issue with custom exceptions not being returned was that in the stub
> when recreating the exception, in the returned AxisFault, 'detail' field is
> being set to null. Therefore the custom exception classname cannot be
> retrieved and only the AxisFault is thrown. I couldn't investigate how the
> detail property is set to null in some exceptions while in other the detail
> property had proper values. Hope this may be of some help to you Lahiru.
> On May 8, 2015 8:16 AM, "Lahiru Sandaruwan" <la...@wso2.com> wrote:
>
>>
>> On Fri, May 8, 2015 at 8:13 AM, Chamila De Alwis <ch...@wso2.com>
>> wrote:
>>
>>> +1
>>> Few notes
>>>
>>> 1. Some of Cloud Controller and Autoscaler backend errors are not
>>> returned as specific custom errors to the stub. Instead they are returned
>>> as AxisFaults. This needs to be investigated and fixed as an additional
>>> measure. Otherwise the change proposed would not be effective.
>>>
>>
>> Correct. I'm working on this as well...
>>
>>>  2. The CLI also doesn't properly check returned status codes when
>>> printing success or failure. This might also help managing those errors.
>>>
>> Will fix this as well.
>>
>> Thanks.
>>
>>>  On May 8, 2015 8:06 AM, "Lahiru Sandaruwan" <la...@wso2.com> wrote:
>>>
>>>> Hi all,
>>>>
>>>> It seems $subject is possible. We wrap real exceptions
>>>> with UserManagerException in this class. IMO this is not correct way of
>>>> handling exceptions.
>>>>
>>>> As a result of this, it returns wrong response.
>>>>
>>>> E.g. Removing non existing user returns "Could not delete user: sd",
>>>> but it should return that user does not exist.
>>>>
>>>> stratos>  remove-user sd
>>>> Could not delete user: sd
>>>>
>>>> Correct way is to let the "StratosApiV41" class handle all the specific
>>>> exceptions and return correct status code with message.
>>>>
>>>> Wdyt?
>>>>
>>>> Thanks.
>>>> --
>>>> --
>>>> Lahiru Sandaruwan
>>>> Committer and PMC member, Apache Stratos,
>>>> Senior Software Engineer,
>>>> WSO2 Inc., http://wso2.com
>>>> lean.enterprise.middleware
>>>>
>>>> phone: +94773325954
>>>> email: lahirus@wso2.com blog: http://lahiruwrites.blogspot.com/
>>>> linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146
>>>>
>>>>
>>
>>
>> --
>> --
>> Lahiru Sandaruwan
>> Committer and PMC member, Apache Stratos,
>> Senior Software Engineer,
>> WSO2 Inc., http://wso2.com
>> lean.enterprise.middleware
>>
>> phone: +94773325954
>> email: lahirus@wso2.com blog: http://lahiruwrites.blogspot.com/
>> linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146
>>
>>


-- 
--
Lahiru Sandaruwan
Committer and PMC member, Apache Stratos,
Senior Software Engineer,
WSO2 Inc., http://wso2.com
lean.enterprise.middleware

phone: +94773325954
email: lahirus@wso2.com blog: http://lahiruwrites.blogspot.com/
linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146

Re: Shall we get rid of "StratosUserManagerUtils"

Posted by Chamila De Alwis <ch...@wso2.com>.
The issue with custom exceptions not being returned was that in the stub
when recreating the exception, in the returned AxisFault, 'detail' field is
being set to null. Therefore the custom exception classname cannot be
retrieved and only the AxisFault is thrown. I couldn't investigate how the
detail property is set to null in some exceptions while in other the detail
property had proper values. Hope this may be of some help to you Lahiru.
On May 8, 2015 8:16 AM, "Lahiru Sandaruwan" <la...@wso2.com> wrote:

>
> On Fri, May 8, 2015 at 8:13 AM, Chamila De Alwis <ch...@wso2.com>
> wrote:
>
>> +1
>> Few notes
>>
>> 1. Some of Cloud Controller and Autoscaler backend errors are not
>> returned as specific custom errors to the stub. Instead they are returned
>> as AxisFaults. This needs to be investigated and fixed as an additional
>> measure. Otherwise the change proposed would not be effective.
>>
>
> Correct. I'm working on this as well...
>
>>  2. The CLI also doesn't properly check returned status codes when
>> printing success or failure. This might also help managing those errors.
>>
> Will fix this as well.
>
> Thanks.
>
>>  On May 8, 2015 8:06 AM, "Lahiru Sandaruwan" <la...@wso2.com> wrote:
>>
>>> Hi all,
>>>
>>> It seems $subject is possible. We wrap real exceptions
>>> with UserManagerException in this class. IMO this is not correct way of
>>> handling exceptions.
>>>
>>> As a result of this, it returns wrong response.
>>>
>>> E.g. Removing non existing user returns "Could not delete user: sd", but
>>> it should return that user does not exist.
>>>
>>> stratos>  remove-user sd
>>> Could not delete user: sd
>>>
>>> Correct way is to let the "StratosApiV41" class handle all the specific
>>> exceptions and return correct status code with message.
>>>
>>> Wdyt?
>>>
>>> Thanks.
>>> --
>>> --
>>> Lahiru Sandaruwan
>>> Committer and PMC member, Apache Stratos,
>>> Senior Software Engineer,
>>> WSO2 Inc., http://wso2.com
>>> lean.enterprise.middleware
>>>
>>> phone: +94773325954
>>> email: lahirus@wso2.com blog: http://lahiruwrites.blogspot.com/
>>> linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146
>>>
>>>
>
>
> --
> --
> Lahiru Sandaruwan
> Committer and PMC member, Apache Stratos,
> Senior Software Engineer,
> WSO2 Inc., http://wso2.com
> lean.enterprise.middleware
>
> phone: +94773325954
> email: lahirus@wso2.com blog: http://lahiruwrites.blogspot.com/
> linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146
>
>

Re: Shall we get rid of "StratosUserManagerUtils"

Posted by Lahiru Sandaruwan <la...@wso2.com>.
On Fri, May 8, 2015 at 8:13 AM, Chamila De Alwis <ch...@wso2.com> wrote:

> +1
> Few notes
>
> 1. Some of Cloud Controller and Autoscaler backend errors are not returned
> as specific custom errors to the stub. Instead they are returned as
> AxisFaults. This needs to be investigated and fixed as an additional
> measure. Otherwise the change proposed would not be effective.
>

Correct. I'm working on this as well...

>  2. The CLI also doesn't properly check returned status codes when
> printing success or failure. This might also help managing those errors.
>
Will fix this as well.

Thanks.

>  On May 8, 2015 8:06 AM, "Lahiru Sandaruwan" <la...@wso2.com> wrote:
>
>> Hi all,
>>
>> It seems $subject is possible. We wrap real exceptions
>> with UserManagerException in this class. IMO this is not correct way of
>> handling exceptions.
>>
>> As a result of this, it returns wrong response.
>>
>> E.g. Removing non existing user returns "Could not delete user: sd", but
>> it should return that user does not exist.
>>
>> stratos>  remove-user sd
>> Could not delete user: sd
>>
>> Correct way is to let the "StratosApiV41" class handle all the specific
>> exceptions and return correct status code with message.
>>
>> Wdyt?
>>
>> Thanks.
>> --
>> --
>> Lahiru Sandaruwan
>> Committer and PMC member, Apache Stratos,
>> Senior Software Engineer,
>> WSO2 Inc., http://wso2.com
>> lean.enterprise.middleware
>>
>> phone: +94773325954
>> email: lahirus@wso2.com blog: http://lahiruwrites.blogspot.com/
>> linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146
>>
>>


-- 
--
Lahiru Sandaruwan
Committer and PMC member, Apache Stratos,
Senior Software Engineer,
WSO2 Inc., http://wso2.com
lean.enterprise.middleware

phone: +94773325954
email: lahirus@wso2.com blog: http://lahiruwrites.blogspot.com/
linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146

Re: Shall we get rid of "StratosUserManagerUtils"

Posted by Chamila De Alwis <ch...@wso2.com>.
+1
Few notes

1. Some of Cloud Controller and Autoscaler backend errors are not returned
as specific custom errors to the stub. Instead they are returned as
AxisFaults. This needs to be investigated and fixed as an additional
measure. Otherwise the change proposed would not be effective.

2. The CLI also doesn't properly check returned status codes when printing
success or failure. This might also help managing those errors.
On May 8, 2015 8:06 AM, "Lahiru Sandaruwan" <la...@wso2.com> wrote:

> Hi all,
>
> It seems $subject is possible. We wrap real exceptions
> with UserManagerException in this class. IMO this is not correct way of
> handling exceptions.
>
> As a result of this, it returns wrong response.
>
> E.g. Removing non existing user returns "Could not delete user: sd", but
> it should return that user does not exist.
>
> stratos>  remove-user sd
> Could not delete user: sd
>
> Correct way is to let the "StratosApiV41" class handle all the specific
> exceptions and return correct status code with message.
>
> Wdyt?
>
> Thanks.
> --
> --
> Lahiru Sandaruwan
> Committer and PMC member, Apache Stratos,
> Senior Software Engineer,
> WSO2 Inc., http://wso2.com
> lean.enterprise.middleware
>
> phone: +94773325954
> email: lahirus@wso2.com blog: http://lahiruwrites.blogspot.com/
> linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146
>
>