|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
ExceptionsAll of the Serializer methods throw the base Exception class. This is extremely inconvenient for programmers to work with when using the API. If I want to have a try statement that covers more than just a single Simple API call, it means that any exception that may get thrown will be caught. If it is an exception I'm not planning or aware of, I want it to ripple all the way to the surface so I can see all the information.
I suggest you create a SimpleException class that is just a sub-class of Exception. This way exceptions thrown by the API can be differentiated from others. This change will not break existing code, as any previous code will still catch SimpleException objects when they are catching Exception objects. The fix is also not complicated and just involves one walk over the source tree to replace the object type in every throw statement. Ideally, I would prefer even more sub-typing to improve exception handeling, but that would require a little more work. Patrick ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Simple-support mailing list Simple-support@... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
|
Re: ExceptionsHi,
Simple will generally throw PersistenceException or
subclasses of this. However, it also throws StAX and reflection exceptions. I
don't think it would require too much work to wrap most exceptions in a
PersistenceException and rethrow them for better typing. Ill look in to
this.
Niall
RBS Global Banking & Markets Office: +44 7879498724 From: Patrick Lannigan [mailto:p.lannigan@...] Sent: 29 September 2009 18:58 To: simple-support@... Subject: [Simple-support] Exceptions I suggest you create a SimpleException class that is just a sub-class of Exception. This way exceptions thrown by the API can be differentiated from others. This change will not break existing code, as any previous code will still catch SimpleException objects when they are catching Exception objects. The fix is also not complicated and just involves one walk over the source tree to replace the object type in every throw statement. Ideally, I would prefer even more sub-typing to improve exception handeling, but that would require a little more work. Patrick *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority. This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our website at www.rbs.com *********************************************************************************** ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Simple-support mailing list Simple-support@... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
|
Re: ExceptionsOk. I didn't go through to check all the code to see what you were actually using with throw statements. In the case that you never actually have "throw new Exception()", the fix is even easier. It would then just be a matter of changing function definitions so that throws actually lists each type rather than doing a general "throws Exception".
As for wrapping the others, that is up to you, but it is what I do. If I'm working on project ABC, the first thing I do is create a ABCException. Then all exceptions I define are inherit from ABCException. After that, when ever I encounter code that throws an exception, I catch it as soon as possible and wrap it into a ABCException sub-class if it isn't something I can handle directly. What I like about this is that when an Exception gets thrown because of a bug in my code, it will become very visible as I never catch non-ABCException on the top level of my code. Patrick On Wed, Sep 30, 2009 at 5:27 AM, <niall.gallagher@...> wrote:
------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Simple-support mailing list Simple-support@... https://lists.sourceforge.net/lists/listinfo/simple-support |
| Free embeddable forum powered by Nabble | Forum Help |