I could able to get errorCode as well since cause.getTargetException()
provide UserPortalUIException.

On Tue, Mar 14, 2017 at 9:24 AM, Gayan Gunawardana <[email protected]> wrote:

>
>
> On Tue, Mar 14, 2017 at 9:17 AM, Ayesha Dissanayaka <[email protected]>
> wrote:
>
>> Hi,
>>
>> I think this[1] has to be fixed from UUF in order to be able to access
>> original exception.
>>
> Still cause.getTargetException() gives original exception, how can we get
> errorCode in that case?
>
>>
>> [1] https://github.com/wso2/carbon-uuf/issues/177
>>
>> Thanks!
>> -Ayesha
>>
>>
>> On Tue, Mar 14, 2017 at 9:10 AM, Gayan Gunawardana <[email protected]>
>> wrote:
>>
>>>
>>> Hi UUF team,
>>>
>>> Client OSGI service throw  UserPortalUIException with error message
>>> (message) and error code (errorCode).
>>>
>>> String error = "Failed to update user password.";
>>> LOGGER.error(error, e);
>>> throw new UserPortalUIException(error, e.getErrorCode());
>>>
>>> Form client side .js I can retrieve error message as below
>>>
>>> } catch (e) {
>>>     var message = e.message;
>>>         var cause = e.getCause();
>>>         if (cause != null) {
>>>             //the exceptions thrown by the actual osgi service method is 
>>> wrapped inside a InvocationTargetException.
>>>             if (cause instanceof 
>>> java.lang.reflect.InvocationTargetException) {
>>>                 message = cause.getTargetException().message;
>>>             }
>>>         }
>>>
>>> Is there a way to retrieve errorCode as well ?
>>>
>>> Thanks,
>>> Gayan
>>>
>>> --
>>> Gayan Gunawardana
>>> Software Engineer; WSO2 Inc.; http://wso2.com/
>>> Email: [email protected]
>>> Mobile: +94 (71) 8020933
>>>
>>
>>
>>
>> --
>> *Ayesha Dissanayaka*
>> Senior Software Engineer,
>> WSO2, Inc : http://wso2.com
>> <http://www.google.com/url?q=http%3A%2F%2Fwso2.com&sa=D&sntz=1&usg=AFQjCNEZvyc0uMD1HhBaEGCBxs6e9fBObg>
>> 20, Palm grove Avenue, Colombo 3
>> E-Mail: [email protected] <[email protected]>
>>
>
>
>
> --
> Gayan Gunawardana
> Software Engineer; WSO2 Inc.; http://wso2.com/
> Email: [email protected]
> Mobile: +94 (71) 8020933
>



-- 
Gayan Gunawardana
Software Engineer; WSO2 Inc.; http://wso2.com/
Email: [email protected]
Mobile: +94 (71) 8020933
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to