David Choi <daft.davy <at> gmail.com> writes:

> 
> Hello,
> 
> When constructing DOM documents to create DOM Representations (or, for that
> matter, JSON Objects for JSONRepresentations), I need to return a 500 Internal
> Server Error when DOM Document/JSON Object creation throws an exception.
> 
> For example:
> JSONObject jObj = new JSONObject();
> try
> {
>   jObj.put("blah", blah);
>   ...
> }
> catch(JSONException e)
> {
>    //something needed here?
> }
> 
> What is the best way to do this?  Currently, if the exception occurs, I just
> skip adding the representation to the list of variants returned by
> getVariants(), but this returns a 404 - Resource Not Found.
> 
> Thanks,
> David
> 
> 

I should clarify:
This is being done on the Resource level.  From my "List<Representation>
getVariants()" method, I call the above methods to create JSON/DOM, and it is
here that I need to set the response status to error 500.

Thanks,
David

Reply via email to