forked from p15670423/monkey
Island: Raise error instead of assert in FlaskDIWrapper.add_resource()
This commit is contained in:
parent
0cdf84cac5
commit
e86c63b135
|
@ -122,7 +122,8 @@ class FlaskDIWrapper:
|
||||||
self._reserved_urls = set()
|
self._reserved_urls = set()
|
||||||
|
|
||||||
def add_resource(self, resource: Type[AbstractResource]):
|
def add_resource(self, resource: Type[AbstractResource]):
|
||||||
assert "urls" in resource.__dict__, f"Resource {resource} has no defined URLs"
|
if len(resource.urls) == 0:
|
||||||
|
raise ValueError(f"Resource {resource.__name__} has no defined URLs")
|
||||||
|
|
||||||
self._reserve_urls(resource.urls)
|
self._reserve_urls(resource.urls)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue