> > @jonathan: Yes, a more detailed error messages than "no json" would be 
> > awesome.
>
> generic.json now says:
>
> {{
> ###
> # response._vars contains the dictionary returned by the controller action
> ###
> try:
>    from gluon.serializers import json
>    response.write(json(response._vars),escape=False)
>    response.headers['Content-Type']='text/json'
> except:
>    raise HTTP(405,'no json')
>
> }}
>
> I suggest this instead:
>
> {{
> ###
> # response._vars contains the dictionary returned by the controller action
> ###
> try:
>         from gluon.serializers import json
>         response.write(json(response._vars), escape=False)
>         response.headers['Content-Type'] = 'application/json'
> except (TypeError, ValueError):
>         raise HTTP(405, 'JSON serialization error')
> except ImportError:
>         raise HTTP(405, 'JSON not available')
> except:
>         raise HTTP(405, 'JSON error')
>
> }}

I patched that in, and changed the last one to say

except Exception, E:
    raise HTTP(405, 'JSON error: ' + str(E))

and got in my case
   JSON error: 'id'

  -Brian

Reply via email to