Hello all,
I agree fully with Paul. Exceptions are the modern way to handle things,
that don't are the normal way. The same thing should be possible for
doPut(..), doGet(..), getRepresentation(.) and so on on subclasses of
org.restlet.resource.Resource.
greetings
Stephan
Paul J. Lucas schrieb:
On Nov 27, 2007, at 1:38 PM, Jerome Louvel wrote:
If we used RestletExceptions 'in addition', we could break this
uniformity
("a handle method given two parameters carrying all the communication
info"), having two ways to bubble up the same information.
But as it is now, it's like going back to programming in C where
exiting from nested functions is tedious and error-prone. For example:
public void handle( Request request, Response response ) {
// ...
T result = otherFunc( /* ... */, response );
if ( result == null ) {
// otherFunc() must have failed
return;
}
}
If otherFunc() can fail in one of several ways, well, in order to set
the Response's status correctly, I have to pass the Response along.
Upon return, I have to check the result explicitly for failure and
return.
If RestletException existed, code such as the above is simplified,
less tedious to write, and less error-prone.