Handle 404 errors
| 19 | |
| 20 | |
| 21 | class JSONErrorBottle(Bottle): |
| 22 | """ |
| 23 | Handle 404 errors |
| 24 | """ |
| 25 | def default_error_handler(self, res): |
| 26 | response.content_type = 'application/json' |
| 27 | return json.dumps(dict(error=res.body, status_code=res.status_code)) |
| 28 | |
| 29 | |
| 30 | app = JSONErrorBottle() |