Island: Raise error instead of assert in FlaskDIWrapper.add_resource()

This commit is contained in:
Mike Salvatore 2022-05-25 06:54:04 -04:00
parent 0cdf84cac5
commit e86c63b135
1 changed files with 2 additions and 1 deletions

View File

@ -122,7 +122,8 @@ class FlaskDIWrapper:
self._reserved_urls = set()
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)