From f2659b0010f49a56eed077e40c5c6b119ce8c5cf Mon Sep 17 00:00:00 2001 From: jar3b Date: Thu, 22 Sep 2016 12:22:12 +0300 Subject: [PATCH] Add multiple error route --- aore/phias.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/aore/phias.py b/aore/phias.py index b6c5a26..6b9f8f6 100644 --- a/aore/phias.py +++ b/aore/phias.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- +from borest import app, Route, Error import json import logging from bottle import response, request from aore.search.fiasfactory import FiasFactory -from borest import app, Route, Error class App(object): @@ -50,15 +50,7 @@ class App(object): return json.dumps(App._factory.gettext(aoid)) @staticmethod - @Error(404) - def basic_error_handler(error): - response.content_type = 'application/json' - response.set_header('Access-Control-Allow-Origin', '*') - - return json.dumps(dict(error=error.status)) - - @staticmethod - @Error(500) + @Error([404, 500]) def basic_error_handler(error): response.content_type = 'application/json' response.set_header('Access-Control-Allow-Origin', '*')