From e86c63b135a1ced9f8762e77c7cbfc45a72a923c Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Wed, 25 May 2022 06:54:04 -0400 Subject: [PATCH] Island: Raise error instead of assert in FlaskDIWrapper.add_resource() --- monkey/monkey_island/cc/app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/monkey/monkey_island/cc/app.py b/monkey/monkey_island/cc/app.py index c973eb2fb..f7a7a3e01 100644 --- a/monkey/monkey_island/cc/app.py +++ b/monkey/monkey_island/cc/app.py @@ -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)