database: don't overwrite "get" server errors
Make sure the correct exception is raised when "get_item" fails. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
2d28a3eeff
commit
5f96822c90
|
@ -333,9 +333,11 @@ class MoonrakerDatabase:
|
|||
ns = self._get_record(namespace, key_list[0])
|
||||
val = reduce(operator.getitem, # type: ignore
|
||||
key_list[1:], ns)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
if not isinstance(default, SentinelClass):
|
||||
return default
|
||||
if isinstance(e, self.server.error):
|
||||
raise
|
||||
raise self.server.error(
|
||||
f"Key '{key}' in namespace '{namespace}' not found", 404)
|
||||
return val
|
||||
|
|
Loading…
Reference in New Issue