Maybe I've just found the answer to my own question - is it something like this:

public Representation getRepresentation(Variant variant) {
....snip...
  } catch (JSONException e) {
        log.error("Error constructing JSON response while returning a user", e);
        this.getResponse().setStatus(
          Status.CLIENT_ERROR_BAD_REQUEST, e.getMessage());
  }
  return null;
}

On Sun, Mar 23, 2008 at 9:05 PM, Ian Clarke <[EMAIL PROTECTED]> wrote:
> What is the appropriate way to report an error back to the caller of a
>  HTTP REST call from a Resource class?
>
>  For example, what if I'm using JSON and there is some kind of JSON
>  parsing error?  Obviously, it would be nice to return a useful error
>  message to the caller of the API.
>
>  I'd really appreciate some example code, say, from within a
>  Resource.put() method.
>
>  Ian.
>
>  --
>  Email: [EMAIL PROTECTED]
>  Cell: +1 512 422 3588
>  Skype: sanity
>



-- 
Email: [EMAIL PROTECTED]
Cell: +1 512 422 3588
Skype: sanity

Reply via email to