You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stratos.apache.org by Imesh Gunaratne <im...@apache.org> on 2015/02/05 12:27:52 UTC

[Discuss] Error Response JSON Message Construction

Hi Devs,

Currently we have error response JSON message construction logic in
following class:

https://github.com/apache/stratos/blob/master/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/Utils.java

Here we have used strings to do $subject without using domain classes. The
downside is these messages do not respect any of the API configurations
done for handling JSON messages. Shall we fix this?

Thanks


-- 
Imesh Gunaratne

Technical Lead, WSO2
Committer & PMC Member, Apache Stratos

Re: [Discuss] Error Response JSON Message Construction

Posted by Imesh Gunaratne <im...@apache.org>.
Great work Sajith! Thanks for fixing it!

On Mon, Feb 9, 2015 at 7:20 AM, Sajith Kariyawasam <sa...@wso2.com> wrote:

> I have fixed this [1] now in commit
> 35a2c1d374b590ae5d9b1822533518ec87371364
>
> [1] https://issues.apache.org/jira/browse/STRATOS-1181
>
> On Fri, Feb 6, 2015 at 4:00 PM, Sajith Kariyawasam <sa...@wso2.com>
> wrote:
>
>> Yes Gayan,
>> In the sample I have used, the errorMessage is the one which comes from
>> the back end.
>> There seems to be some issue in propagating the exception messages via
>> service stubs, it doesn't log the proper error message.
>> [This is discussed in "Error log does not contains much information"
>> thread]
>> Once that issue is sorted out, same error message will appear here
>>
>> On Fri, Feb 6, 2015 at 3:48 PM, Gayan Gunarathne <ga...@wso2.com> wrote:
>>
>>> IMO we can add descriptive error message to the error as well.
>>>
>>> Thanks,
>>> Gayan
>>>
>>> On Fri, Feb 6, 2015 at 3:32 PM, Sajith Kariyawasam <sa...@wso2.com>
>>> wrote:
>>>
>>>> I have done the necessary changes, and being tested locally. Will
>>>> commit once fully tested.
>>>>
>>>> Now the response messages are as follows,
>>>>
>>>> When there is an error :
>>>>  {"errorCode":400,"errorMessage":"CloudControllerServiceCartridgeNotFoundExceptionException"}
>>>> When operation is successful :   {"statusCode":200,
>>>> "message":"Cartridge added successfully"}
>>>>
>>>> Appreciate your thoughts on this..
>>>>
>>>> Thanks,
>>>> Sajith
>>>>
>>>>
>>>> On Thu, Feb 5, 2015 at 5:51 PM, Dakshika Jayathilaka <dakshika@wso2.com
>>>> > wrote:
>>>>
>>>>> Hi All,
>>>>>
>>>>> Better if we can return meaningful success messages as wel. (Instead
>>>>> of just saying success).
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Regards,
>>>>>
>>>>> *Dakshika Jayathilaka*
>>>>> Software Engineer
>>>>> WSO2, Inc.
>>>>> lean.enterprise.middleware
>>>>> 0771100911
>>>>>
>>>>> On Thu, Feb 5, 2015 at 5:32 PM, Sajith Kariyawasam <sa...@wso2.com>
>>>>> wrote:
>>>>>
>>>>>> Hi Imesh,
>>>>>>
>>>>>> yes its better to fix this. I will do the fix
>>>>>>
>>>>>> Thanks,
>>>>>> Sajith
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Thu, Feb 5, 2015 at 4:57 PM, Imesh Gunaratne <im...@apache.org>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi Devs,
>>>>>>>
>>>>>>> Currently we have error response JSON message construction logic in
>>>>>>> following class:
>>>>>>>
>>>>>>>
>>>>>>> https://github.com/apache/stratos/blob/master/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/Utils.java
>>>>>>>
>>>>>>> Here we have used strings to do $subject without using domain
>>>>>>> classes. The downside is these messages do not respect any of the API
>>>>>>> configurations done for handling JSON messages. Shall we fix this?
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Imesh Gunaratne
>>>>>>>
>>>>>>> Technical Lead, WSO2
>>>>>>> Committer & PMC Member, Apache Stratos
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>>
>>> Gayan Gunarathne
>>> Technical Lead
>>> WSO2 Inc. (http://wso2.com)
>>> email  : gayang@wso2.com  | mobile : +94 766819985
>>>
>>>
>>
>>
>


-- 
Imesh Gunaratne

Technical Lead, WSO2
Committer & PMC Member, Apache Stratos

Re: [Discuss] Error Response JSON Message Construction

Posted by Sajith Kariyawasam <sa...@wso2.com>.
I have fixed this [1] now in commit 35a2c1d374b590ae5d9b1822533518ec87371364

[1] https://issues.apache.org/jira/browse/STRATOS-1181

On Fri, Feb 6, 2015 at 4:00 PM, Sajith Kariyawasam <sa...@wso2.com> wrote:

> Yes Gayan,
> In the sample I have used, the errorMessage is the one which comes from
> the back end.
> There seems to be some issue in propagating the exception messages via
> service stubs, it doesn't log the proper error message.
> [This is discussed in "Error log does not contains much information"
> thread]
> Once that issue is sorted out, same error message will appear here
>
> On Fri, Feb 6, 2015 at 3:48 PM, Gayan Gunarathne <ga...@wso2.com> wrote:
>
>> IMO we can add descriptive error message to the error as well.
>>
>> Thanks,
>> Gayan
>>
>> On Fri, Feb 6, 2015 at 3:32 PM, Sajith Kariyawasam <sa...@wso2.com>
>> wrote:
>>
>>> I have done the necessary changes, and being tested locally. Will commit
>>> once fully tested.
>>>
>>> Now the response messages are as follows,
>>>
>>> When there is an error :
>>>  {"errorCode":400,"errorMessage":"CloudControllerServiceCartridgeNotFoundExceptionException"}
>>> When operation is successful :   {"statusCode":200, "message":"Cartridge
>>> added successfully"}
>>>
>>> Appreciate your thoughts on this..
>>>
>>> Thanks,
>>> Sajith
>>>
>>>
>>> On Thu, Feb 5, 2015 at 5:51 PM, Dakshika Jayathilaka <da...@wso2.com>
>>> wrote:
>>>
>>>> Hi All,
>>>>
>>>> Better if we can return meaningful success messages as wel. (Instead of
>>>> just saying success).
>>>>
>>>> Thanks,
>>>>
>>>> Regards,
>>>>
>>>> *Dakshika Jayathilaka*
>>>> Software Engineer
>>>> WSO2, Inc.
>>>> lean.enterprise.middleware
>>>> 0771100911
>>>>
>>>> On Thu, Feb 5, 2015 at 5:32 PM, Sajith Kariyawasam <sa...@wso2.com>
>>>> wrote:
>>>>
>>>>> Hi Imesh,
>>>>>
>>>>> yes its better to fix this. I will do the fix
>>>>>
>>>>> Thanks,
>>>>> Sajith
>>>>>
>>>>>
>>>>>
>>>>> On Thu, Feb 5, 2015 at 4:57 PM, Imesh Gunaratne <im...@apache.org>
>>>>> wrote:
>>>>>
>>>>>> Hi Devs,
>>>>>>
>>>>>> Currently we have error response JSON message construction logic in
>>>>>> following class:
>>>>>>
>>>>>>
>>>>>> https://github.com/apache/stratos/blob/master/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/Utils.java
>>>>>>
>>>>>> Here we have used strings to do $subject without using domain
>>>>>> classes. The downside is these messages do not respect any of the API
>>>>>> configurations done for handling JSON messages. Shall we fix this?
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Imesh Gunaratne
>>>>>>
>>>>>> Technical Lead, WSO2
>>>>>> Committer & PMC Member, Apache Stratos
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>>
>> --
>>
>> Gayan Gunarathne
>> Technical Lead
>> WSO2 Inc. (http://wso2.com)
>> email  : gayang@wso2.com  | mobile : +94 766819985
>>
>>
>
>

Re: [Discuss] Error Response JSON Message Construction

Posted by Sajith Kariyawasam <sa...@wso2.com>.
Yes Gayan,
In the sample I have used, the errorMessage is the one which comes from the
back end.
There seems to be some issue in propagating the exception messages via
service stubs, it doesn't log the proper error message.
[This is discussed in "Error log does not contains much information" thread]
Once that issue is sorted out, same error message will appear here

On Fri, Feb 6, 2015 at 3:48 PM, Gayan Gunarathne <ga...@wso2.com> wrote:

> IMO we can add descriptive error message to the error as well.
>
> Thanks,
> Gayan
>
> On Fri, Feb 6, 2015 at 3:32 PM, Sajith Kariyawasam <sa...@wso2.com>
> wrote:
>
>> I have done the necessary changes, and being tested locally. Will commit
>> once fully tested.
>>
>> Now the response messages are as follows,
>>
>> When there is an error :
>>  {"errorCode":400,"errorMessage":"CloudControllerServiceCartridgeNotFoundExceptionException"}
>> When operation is successful :   {"statusCode":200, "message":"Cartridge
>> added successfully"}
>>
>> Appreciate your thoughts on this..
>>
>> Thanks,
>> Sajith
>>
>>
>> On Thu, Feb 5, 2015 at 5:51 PM, Dakshika Jayathilaka <da...@wso2.com>
>> wrote:
>>
>>> Hi All,
>>>
>>> Better if we can return meaningful success messages as wel. (Instead of
>>> just saying success).
>>>
>>> Thanks,
>>>
>>> Regards,
>>>
>>> *Dakshika Jayathilaka*
>>> Software Engineer
>>> WSO2, Inc.
>>> lean.enterprise.middleware
>>> 0771100911
>>>
>>> On Thu, Feb 5, 2015 at 5:32 PM, Sajith Kariyawasam <sa...@wso2.com>
>>> wrote:
>>>
>>>> Hi Imesh,
>>>>
>>>> yes its better to fix this. I will do the fix
>>>>
>>>> Thanks,
>>>> Sajith
>>>>
>>>>
>>>>
>>>> On Thu, Feb 5, 2015 at 4:57 PM, Imesh Gunaratne <im...@apache.org>
>>>> wrote:
>>>>
>>>>> Hi Devs,
>>>>>
>>>>> Currently we have error response JSON message construction logic in
>>>>> following class:
>>>>>
>>>>>
>>>>> https://github.com/apache/stratos/blob/master/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/Utils.java
>>>>>
>>>>> Here we have used strings to do $subject without using domain classes.
>>>>> The downside is these messages do not respect any of the API configurations
>>>>> done for handling JSON messages. Shall we fix this?
>>>>>
>>>>> Thanks
>>>>>
>>>>>
>>>>> --
>>>>> Imesh Gunaratne
>>>>>
>>>>> Technical Lead, WSO2
>>>>> Committer & PMC Member, Apache Stratos
>>>>>
>>>>
>>>>
>>>
>>
>
>
> --
>
> Gayan Gunarathne
> Technical Lead
> WSO2 Inc. (http://wso2.com)
> email  : gayang@wso2.com  | mobile : +94 766819985
>
>

Re: [Discuss] Error Response JSON Message Construction

Posted by Gayan Gunarathne <ga...@wso2.com>.
IMO we can add descriptive error message to the error as well.

Thanks,
Gayan

On Fri, Feb 6, 2015 at 3:32 PM, Sajith Kariyawasam <sa...@wso2.com> wrote:

> I have done the necessary changes, and being tested locally. Will commit
> once fully tested.
>
> Now the response messages are as follows,
>
> When there is an error :
>  {"errorCode":400,"errorMessage":"CloudControllerServiceCartridgeNotFoundExceptionException"}
> When operation is successful :   {"statusCode":200, "message":"Cartridge
> added successfully"}
>
> Appreciate your thoughts on this..
>
> Thanks,
> Sajith
>
>
> On Thu, Feb 5, 2015 at 5:51 PM, Dakshika Jayathilaka <da...@wso2.com>
> wrote:
>
>> Hi All,
>>
>> Better if we can return meaningful success messages as wel. (Instead of
>> just saying success).
>>
>> Thanks,
>>
>> Regards,
>>
>> *Dakshika Jayathilaka*
>> Software Engineer
>> WSO2, Inc.
>> lean.enterprise.middleware
>> 0771100911
>>
>> On Thu, Feb 5, 2015 at 5:32 PM, Sajith Kariyawasam <sa...@wso2.com>
>> wrote:
>>
>>> Hi Imesh,
>>>
>>> yes its better to fix this. I will do the fix
>>>
>>> Thanks,
>>> Sajith
>>>
>>>
>>>
>>> On Thu, Feb 5, 2015 at 4:57 PM, Imesh Gunaratne <im...@apache.org>
>>> wrote:
>>>
>>>> Hi Devs,
>>>>
>>>> Currently we have error response JSON message construction logic in
>>>> following class:
>>>>
>>>>
>>>> https://github.com/apache/stratos/blob/master/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/Utils.java
>>>>
>>>> Here we have used strings to do $subject without using domain classes.
>>>> The downside is these messages do not respect any of the API configurations
>>>> done for handling JSON messages. Shall we fix this?
>>>>
>>>> Thanks
>>>>
>>>>
>>>> --
>>>> Imesh Gunaratne
>>>>
>>>> Technical Lead, WSO2
>>>> Committer & PMC Member, Apache Stratos
>>>>
>>>
>>>
>>
>


-- 

Gayan Gunarathne
Technical Lead
WSO2 Inc. (http://wso2.com)
email  : gayang@wso2.com  | mobile : +94 766819985

Re: [Discuss] Error Response JSON Message Construction

Posted by Sajith Kariyawasam <sa...@wso2.com>.
I have done the necessary changes, and being tested locally. Will commit
once fully tested.

Now the response messages are as follows,

When there is an error :
 {"errorCode":400,"errorMessage":"CloudControllerServiceCartridgeNotFoundExceptionException"}
When operation is successful :   {"statusCode":200, "message":"Cartridge
added successfully"}

Appreciate your thoughts on this..

Thanks,
Sajith


On Thu, Feb 5, 2015 at 5:51 PM, Dakshika Jayathilaka <da...@wso2.com>
wrote:

> Hi All,
>
> Better if we can return meaningful success messages as wel. (Instead of
> just saying success).
>
> Thanks,
>
> Regards,
>
> *Dakshika Jayathilaka*
> Software Engineer
> WSO2, Inc.
> lean.enterprise.middleware
> 0771100911
>
> On Thu, Feb 5, 2015 at 5:32 PM, Sajith Kariyawasam <sa...@wso2.com>
> wrote:
>
>> Hi Imesh,
>>
>> yes its better to fix this. I will do the fix
>>
>> Thanks,
>> Sajith
>>
>>
>>
>> On Thu, Feb 5, 2015 at 4:57 PM, Imesh Gunaratne <im...@apache.org> wrote:
>>
>>> Hi Devs,
>>>
>>> Currently we have error response JSON message construction logic in
>>> following class:
>>>
>>>
>>> https://github.com/apache/stratos/blob/master/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/Utils.java
>>>
>>> Here we have used strings to do $subject without using domain classes.
>>> The downside is these messages do not respect any of the API configurations
>>> done for handling JSON messages. Shall we fix this?
>>>
>>> Thanks
>>>
>>>
>>> --
>>> Imesh Gunaratne
>>>
>>> Technical Lead, WSO2
>>> Committer & PMC Member, Apache Stratos
>>>
>>
>>
>

Re: [Discuss] Error Response JSON Message Construction

Posted by Dakshika Jayathilaka <da...@wso2.com>.
Hi All,

Better if we can return meaningful success messages as wel. (Instead of
just saying success).

Thanks,

Regards,

*Dakshika Jayathilaka*
Software Engineer
WSO2, Inc.
lean.enterprise.middleware
0771100911

On Thu, Feb 5, 2015 at 5:32 PM, Sajith Kariyawasam <sa...@wso2.com> wrote:

> Hi Imesh,
>
> yes its better to fix this. I will do the fix
>
> Thanks,
> Sajith
>
>
>
> On Thu, Feb 5, 2015 at 4:57 PM, Imesh Gunaratne <im...@apache.org> wrote:
>
>> Hi Devs,
>>
>> Currently we have error response JSON message construction logic in
>> following class:
>>
>>
>> https://github.com/apache/stratos/blob/master/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/Utils.java
>>
>> Here we have used strings to do $subject without using domain classes.
>> The downside is these messages do not respect any of the API configurations
>> done for handling JSON messages. Shall we fix this?
>>
>> Thanks
>>
>>
>> --
>> Imesh Gunaratne
>>
>> Technical Lead, WSO2
>> Committer & PMC Member, Apache Stratos
>>
>
>

Re: [Discuss] Error Response JSON Message Construction

Posted by Sajith Kariyawasam <sa...@wso2.com>.
Hi Imesh,

yes its better to fix this. I will do the fix

Thanks,
Sajith



On Thu, Feb 5, 2015 at 4:57 PM, Imesh Gunaratne <im...@apache.org> wrote:

> Hi Devs,
>
> Currently we have error response JSON message construction logic in
> following class:
>
>
> https://github.com/apache/stratos/blob/master/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/Utils.java
>
> Here we have used strings to do $subject without using domain classes. The
> downside is these messages do not respect any of the API configurations
> done for handling JSON messages. Shall we fix this?
>
> Thanks
>
>
> --
> Imesh Gunaratne
>
> Technical Lead, WSO2
> Committer & PMC Member, Apache Stratos
>