Errors and the introspection format

Havoc Pennington hp at redhat.com
Sun Feb 19 11:12:35 PST 2006


On Sun, 2006-02-19 at 18:35 +0000, Matthew Johnson wrote:
> I just think that the introspection format should contain what
> exceptions I should be looking out for. It makes my life easier in both
> Java and other languages if they are written down next to the function
> definition. An annotation is fine, it doesn't need to be the formal type
> of the function, but it should be there.

You aren't addressing any of the points I'm bringing up, though. If you
just want to know what you're looking out for, then I've proposed a
couple things that will help:
 - put the exceptions in the docs introspection data, alongside  
   docstrings however we do those
 - globally list exceptions that should have a mapping to a class, 
   so you can use them in a catch() block

The only additional thing you can do is have _checked_ exceptions that
get declared in a Java throws clause, and that is not the same as
knowing what exceptions to look out for. That's putting exceptions _in
the type signature_ of the method, which raises a number of issues that
we can simply avoid by not doing it.

The throws clause in the Java bindings should be one of two things:
 - "throws DBusException" where DBusException is checked (pedantically 
   correct approach, like JMSException or InvocationTargetException)
 - no throws clause at all, but @throws DBusException in the docs 
   where DBusException is unchecked (this is what Java RMI does for 
   example, or also comparable to EJBException)

I prefer the first really, but I think most programmers prefer the
second.

Havoc




More information about the dbus mailing list