Errors: Add the ability to error with json

This commit is contained in:
Andre D
2012-08-24 11:37:34 -05:00
committed by Neil Williams
parent 1d64fa367c
commit 5267642908

View File

@@ -165,7 +165,10 @@ class ErrorController(RedditController):
c.response.content = str(code)
return c.response
elif c.render_style == "api":
c.response.content = "{\"error\": %s}" % code
if 'usable_error_content' in request.environ:
c.response.content = request.environ['usable_error_content']
else:
c.response.content = "{\"error\": %s}" % code
return c.response
elif takedown and code == 404:
link = Link._by_fullname(takedown)