Open
Description
404 (NOT FOUND) is likely the correct status rather than 500 (INTERNAL SERVER ERROR)
looks like if you do the following a 404 error is returned correctly. I tested it with a broad try/except but the KeyError looks to be the exception that gets triggered.
from http.webserver import HTTPException
...
...
...
class Modules():
def get(self, data, sensors, logger: uLogger) -> str:
logger.info("API request - sensors/modules")
try:
html = dumps(sensors.get_modules())
logger.info(f"Return value: {html}")
except KeyError:
raise HTTPException(404)
return html
Originally posted by @sam57719 in somakeit/smib#276 (comment)