Hi all,

I'm currently exploring with the addition of a ResourceException to the
org.restlet.resource package. It would let the resource developer handle
response statuses in higher level resource methods as suggested in our
recent discussion.

This exception has different constructors to set its "status" property. I
would also like to add a few static methods for common exceptions like
ResourceException.notFound(), forbidden(), etc.

As we are deprecating the post(), put() and delete() methods in
Restlet 1.1M1, in favor of the less ambiguous acceptRepresentation(),
storeRepresentation() methods, we can declare them as throwing
ResourceException and do the catching work in the deprecated methods. In
version 1.2, we can remove the deprecated method and move the catching logic
directly into the handle*() methods.

For the getRepresentation(Variant) method, would could deprecate it in favor
of a new "represent(Variant)" method that would also throw the exception.
getRepresentation(Variant) would by default invoke representation(Variant)
and catch the ResourceExceptions.

ResourceException would extend Exception class as some cases are not purely
IO related, but more functional errors (ex: "you don't have the right to do
this operation").

How does it sounds?

Best regards,
Jerome

Reply via email to