On Thu, Oct 20, 2016 at 3:57 PM, Uvindra Dias Jayasinha <[email protected]> wrote:
> Hi Harsha, > > Defining error codes for the specific exception at component level is > fine. I only said that its difficult to define generic exceptions that can > be used by all components in the platform generically. This should be > defined by the individual component developers. > Agree. > > On 20 October 2016 at 15:34, Harsha Thirimanna <[email protected]> wrote: > >> Yes, my concern was , even though we identified the exception clearly, >> that exception also can be thrown because of different reason in different >> level of same component. So to get some decision in higher level, we may >> have to identify that clearly and to do that we can have error codes >> within a component at least. Am I wrong here ? >> >> *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 3:31 PM, Harsha Kumara <[email protected]> wrote: >> >>> Definitely we need to have well defined set of exceptions instead using >>> APIManagementException in all places. As Uvindra mentioned, for API Manager >>> database access, we can have APIMDAOExcepton. For security related >>> exceptions we can have APIMSecurityException and so on. In jaggary level >>> also we check the instance type of a thrown exception and return responses >>> accordingly. >>> >>> [1] http://howtodoinjava.com/best-practices/java-exception-h >>> andling-best-practices/ >>> >>> 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 >>>> >>> >>> >>> >>> -- >>> Harsha Kumara >>> Software Engineer, WSO2 Inc. >>> Mobile: +94775505618 >>> Blog:harshcreationz.blogspot.com >>> >>> _______________________________________________ >>> 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
