|
@@ -9,10 +9,11 @@ from apispec.ext.marshmallow.swagger import schema2jsonschema
|
9
|
9
|
|
10
|
10
|
from hapic.decorator import DecoratedController
|
11
|
11
|
from hapic.decorator import DECORATION_ATTRIBUTE_NAME
|
12
|
|
-
|
13
|
|
-# Bottle regular expression to locate url parameters
|
14
|
12
|
from hapic.description import ControllerDescription
|
|
13
|
+from hapic.exception import NoRoutesException
|
|
14
|
+from hapic.exception import RouteNotFound
|
15
|
15
|
|
|
16
|
+# Bottle regular expression to locate url parameters
|
16
|
17
|
BOTTLE_RE_PATH_URL = re.compile(r'<(?:[^:<>]+:)?([^<>]+)>')
|
17
|
18
|
|
18
|
19
|
|
|
@@ -21,8 +22,7 @@ def find_bottle_route(
|
21
|
22
|
app: bottle.Bottle,
|
22
|
23
|
):
|
23
|
24
|
if not app.routes:
|
24
|
|
- # TODO BS 20171010: specialize exception, see #9
|
25
|
|
- raise Exception('There is no routes in yout bottle app')
|
|
25
|
+ raise NoRoutesException('There is no routes in yout bottle app')
|
26
|
26
|
|
27
|
27
|
reference = decorated_controller.reference
|
28
|
28
|
for route in app.routes:
|
|
@@ -38,9 +38,8 @@ def find_bottle_route(
|
38
|
38
|
|
39
|
39
|
if match_with_wrapper or match_with_wrapped or match_with_token:
|
40
|
40
|
return route
|
41
|
|
- # TODO BS 20171010: specialize exception, see #9
|
42
|
41
|
# TODO BS 20171010: Raise exception or print error ? see #10
|
43
|
|
- raise Exception(
|
|
42
|
+ raise RouteNotFound(
|
44
|
43
|
'Decorated route "{}" was not found in bottle routes'.format(
|
45
|
44
|
decorated_controller.name,
|
46
|
45
|
)
|