At present, it appears that 404 is the only error code that can be returned from
Handler::handle().  Either a non-null Resource is returned from findTarget() and
returned correctly, or the return value is null and the result is a 404.

I want to return different error codes from within findTarget(), more
specifically 400 and potentially 401, depending on the input.  Originally the
plan was to do this by creating a child class where the entire body of handle()
is wrapped in a try/catch block and throwing exceptions up past the place where
null results get converted into 404 errors, to be caught and converted to error
codes as needed.  However, that requires creating a new method to replace
findTarget so it can have a throws statement in its signature, and is also
extremely brittle to change (as the differences in the Handler between b20 and
b23 show).

Is there a better way to have more control over what error codes individual
restlets can return?

Reply via email to