Frank Schönheit - Sun Microsystems Germany wrote: > Hi Mathias, > >>>> void approveInsertElement( [in] ContainerEvent Event ) >>>> raises ( VetoException, WrappedTargetException ); >>> >>>Hmm. Would require to move css.util.VetoException from offapi to udkapi. >>>Sounds reasonable to me (missed a generic "VetoException" more than >>>once). Opinions? >> >> Meanwhile I consider exceptions to be the wrong way to manage a veto. >> This will prevent all languages from using this interface that don't >> support exceptions except by catching them for an internal error >> handling, like e.g. OOo Basic. I would opt for a return value instead. > > An exception allows to specify at least an error message, plus a context > (the component which vetoed), which I both consider useful in some > cases. So, I would use an exception for the return value, then - which > is quite weird. > > Not to mention that exceptions allow for "polymorphism" in that you can > throw derived exceptions with additional information, which isn't > possible with return values. > > > Seeing it this way, and given that other Basic dialects nowadays support > modern constructs like try-catch, I really think we should not limit UNO > API design to the constraints of a particular UNO language binding, but > improve this binding instead.
IMHO we should restrict the use of exceptions to error handling. In every case where you throw an exception you should be OK with preventing futher execution of the code of the caller. Wether this is true in your special case is something I can't judge, but at least I consider it to be the wrong approach for a *generic* API where each and every failed insert approach will throw an exception, leaving no way for a basic script to ignore this silently or handle it without a user interaction even if it would be fine to do so. We did this mistake in our css.util.XCloseable interface and now we had to add a locking service that just removes the complexity of the exception process for those who don't want to or can't deal with it. Best regards, Mathias -- Mathias Bauer - OpenOffice.org Application Framework Project Lead Please reply to the list only, [EMAIL PROTECTED] is a spam sink. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
