Hi Harsha,

I think its difficult to make this generic across the entire platform, for
one it would take us forever to come to an agreement :)

Important thing is that the users of the given component can identify what
has gone wrong clearly based on the exception thrown. So I think its fine
for each component to define their own exception independently.

On 20 October 2016 at 15:15, Harsha Thirimanna <[email protected]> wrote:

> +1 for that approach to have specific exceptions for each component to
> clearly identify the exception and where it come from.
> And when we catch some exception, we may have to decide what we should do
> based on the exception. May be exception type or may be the based on
> content. It would be easy if we can maintain error code in each component
> level and introduce error code in the exception class as well. Then we can
> catch and specifically check that if we want. This would be consistent and
> can be introduce for each component define its own error code or can be
> defined across the platform in more generic way. WDYT ?
>
>
> *Harsha Thirimanna*
> Associate Tech Lead | WSO2
>
> Email: [email protected]
> Mob: +94715186770
> Blog: http://harshathirimanna.blogspot.com/
> Twitter: http://twitter.com/harshathirimann
> Linked-In: linked-in: http://www.linkedin.com/pub/ha
> rsha-thirimanna/10/ab8/122
> <http://wso2.com/signature>
>
> On Thu, Oct 20, 2016 at 2:51 PM, Uvindra Dias Jayasinha <[email protected]>
> wrote:
>
>> Hi Malintha,
>>
>> What do we gain by defining an exception hierarchy? As long as we can
>> differentiate between exceptions that should be enough.
>>
>>
>> On 20 October 2016 at 14:46, Malintha Amarasinghe <[email protected]>
>> wrote:
>>
>>> Hi Uvindra,
>>>
>>> +1 for defining specific exceptions.
>>> How about when defining a new APIMDAOException, extending it from a
>>> general APIManagementException? When there's another specific DAO
>>> related exception we can extend it from APIMDAOException.
>>> In that way, we can group specific types of exceptions in a hierarchical
>>> manner.
>>> WDYT?
>>>
>>> Thanks!
>>>
>>> On Thu, Oct 20, 2016 at 2:27 PM, Uvindra Dias Jayasinha <
>>> [email protected]> wrote:
>>>
>>>> I would like to know your thoughts on $subject.
>>>>
>>>> Previously we have a single custom exception class in APIM called
>>>> 'APIManagementException' and this was used when throwing exceptions
>>>> specific to the APIM product. Pros and Cons of doing it this way are,
>>>>
>>>> *Pros* - Only one APIM specific exception needs to be handled in the
>>>> entire APIM code base
>>>>
>>>> *Cons* - When an exception is thrown its very difficult to pin point
>>>> the reason for the exception to be thrown. This results in,
>>>>
>>>> 1. Having to solely depend on the error message of the exception to
>>>> determine what has happened(Provided that the error message is clear)
>>>>
>>>> 2. Difficult to handle exception appropriately at code level because we
>>>> are not aware of the specifics of the exception
>>>>
>>>>
>>>> In light of this doesn't it make sense to define specific custom
>>>> exceptions? For example when interacting with the DAO component of APIM if
>>>> any data access errors are encountered we could define an
>>>> 'APIMDAOException' and throw that. This allows users of the DAO component
>>>> to clearly identify and handle that specific exception appropriately.
>>>>
>>>>
>>>> This obviously needs to be applied in a way that makes sense at
>>>> component level(DAO, Gateway, etc.) so its clear which specific component
>>>> has run into an issue.
>>>>
>>>> WDYT?
>>>>
>>>> --
>>>> Regards,
>>>> Uvindra
>>>>
>>>> Mobile: 777733962
>>>>
>>>
>>>
>>>
>>> --
>>> Malintha Amarasinghe
>>> Software Engineer
>>> *WSO2, Inc. - lean | enterprise | middleware*
>>> http://wso2.com/
>>>
>>> Mobile : +94 712383306
>>>
>>
>>
>>
>> --
>> Regards,
>> Uvindra
>>
>> Mobile: 777733962
>>
>> _______________________________________________
>> Architecture mailing list
>> [email protected]
>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>
>>
>


-- 
Regards,
Uvindra

Mobile: 777733962
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to