Hi Gayan and All,

+1 for having a well-defined exception hierarchy over having a set of error
code returns in describing specific errors.

Although error codes are light-weight, they can easily go unnoticed and
ignored by callers of the functions. So they provide the potential for
error-prone code which should be avoided.

On the other hand, exceptions, although heavy-weight, force the callers of
the functions to deal with errors in some way which is far more safer in
IMO.

So, in this case, it is preferable to extend identity server and specially,
the identity client exceptions to whatever the much important
decision-making oriented errors that we want to expose to clients.

Thanks,
Dilan.


*Dilan U. Ariyaratne*
Senior Software Engineer
WSO2 Inc. <http://wso2.com/>
Mobile: +94766405580 <%2B94766405580>
lean . enterprise . middleware


On Tue, Feb 28, 2017 at 10:37 AM, Gayan Gunawardana <[email protected]> wrote:

>
>
> On Mon, Feb 27, 2017 at 6:52 PM, Omindu Rathnaweera <[email protected]>
> wrote:
>
>> We already have a JIRA[1] and a redmine for this.
>>
>> One requirement I came across was to identify when we are adding a
>> duplicate user. ATM we don't have a method to identify without checking
>> 'isUserExist'. It's better if we can at least introduce an error code for
>> this.
>>
>> @Gayan might have come across similar requirements while developing the
>> SCIM component.
>>
> Yes.
>
>>
>> [1] - https://wso2.org/jira/browse/IDENTITY-5768
>>
>> On Mon, Feb 27, 2017 at 6:31 PM, Thanuja Jayasinghe <[email protected]>
>> wrote:
>>
>>> Hi Gayan,
>>>
>>> We have already defined an exception hierarchy for identity components.
>>>
>>> IdentityException[1]
>>> ├── IdentityServerException[2]
>>> └── IdentityClientException[3]
>>>
>>>  All exceptions classes defined for identity components extend either 
>>> IdentityServerException
>>> or IdentityClientException.
>>>
>>> So any client can catch the exception as follows,
>>>
>>> catch (IdentityClientException ex) {
>>> // Can return the same error message and code to the client
>>> } catch (IdentityException ex) {
>>> // Need to log and return a generic message to the client
>>> }
>>>
>> This is fine when we propagate exception to out side. IdentityStore APIs
> are extensively used by other identity components where they want to take
> decisions based on exceptions provided by IdentityStore APIs. Just by
> having IdentityServerException, IdentityClientException does not provide
> exact idea to API consumer.
>
> I guess answer to above question is having error codes. As I mentioned in
> the initial mail, isn't it better to have exception hierarchy than error
> codes ?
>
>
>>> Since we add these exception classes recently, we need to
>>> update carbon-identity-mgt repo.
>>>
>>> [1] - https://github.com/wso2/carbon-identity-commons/blob/maste
>>> r/components/org.wso2.carbon.identity.common/src/main/java/o
>>> rg/wso2/carbon/identity/common/base/exception/IdentityException.java
>>> [2] - https://github.com/wso2/carbon-identity-commons/blob/maste
>>> r/components/org.wso2.carbon.identity.common/src/main/java/o
>>> rg/wso2/carbon/identity/common/base/exception/IdentityServer
>>> Exception.java
>>> [3] - https://github.com/wso2/carbon-identity-commons/blob/maste
>>> r/components/org.wso2.carbon.identity.common/src/main/java/o
>>> rg/wso2/carbon/identity/common/base/exception/IdentityClient
>>> Exception.java
>>>
>>> Thanks,
>>> Thanuja
>>>
>>> On Mon, Feb 27, 2017 at 10:06 AM, Ruwan Abeykoon <[email protected]>
>>> wrote:
>>>
>>>> Hi All,
>>>> +1 to have an exception hierarchy, which carries information for
>>>> specific errors.
>>>>
>>>> I think we should follow the way Java IO exceptions are done.
>>>>
>>>> Cheers,
>>>> Ruwan
>>>>
>>>>
>>>> On Mon, Feb 27, 2017 at 9:58 AM, Gayan Gunawardana <[email protected]>
>>>> wrote:
>>>>
>>>>> Hi All,
>>>>>
>>>>> Shall we revisit IdentityStore APIs? For an example addUser method[1]
>>>>> throws IdentityStoreClientException and IdentityStoreServerException
>>>>> in many cases where client cannot differentiate the reason. There will be
>>>>> relevant error message but client cannot rely on error message to take
>>>>> decisions.
>>>>> IMO we should have proper exception hierarchy or error codes. I'm +1
>>>>> to have
>>>>> exception hierarchy.
>>>>>
>>>>> WDYT ?
>>>>>
>>>>> [1] https://github.com/wso2/carbon-identity-mgt/blob/master/comp
>>>>> onents/org.wso2.carbon.identity.mgt/src/main/java/org/wso2/c
>>>>> arbon/identity/mgt/impl/IdentityStoreImpl.java#L985
>>>>>
>>>>> Thanks,
>>>>> Gayan
>>>>> --
>>>>> Gayan Gunawardana
>>>>> Software Engineer; WSO2 Inc.; http://wso2.com/
>>>>> Email: [email protected]
>>>>> Mobile: +94 (71) 8020933
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> *Ruwan Abeykoon*
>>>> *Associate Director/Architect**,*
>>>> *WSO2, Inc. http://wso2.com <https://wso2.com/signature> *
>>>> *lean.enterprise.middleware.*
>>>>
>>>>
>>>
>>>
>>> --
>>> *Thanuja Lakmal*
>>> Senior Software Engineer
>>> WSO2 Inc. http://wso2.com/
>>> *lean.enterprise.middleware*
>>> Mobile: +94715979891 +94758009992
>>>
>>
>>
>>
>> --
>> Omindu Rathnaweera
>> Software Engineer, WSO2 Inc.
>> Mobile: +94 771 197 211 <+94%2077%20119%207211>
>>
>
>
>
> --
> Gayan Gunawardana
> Software Engineer; WSO2 Inc.; http://wso2.com/
> Email: [email protected]
> Mobile: +94 (71) 8020933
>
> _______________________________________________
> Architecture mailing list
> [email protected]
> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>
>
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to