mirror of
https://github.com/xcat2/confluent.git
synced 2025-01-14 19:57:50 +00:00
More gracefully fail when client goes off the rails.
A client with certain URLs that go off the end of the valid world was causing exceptions to be thrown not of the set of 'tame' errors. Denote them as 404 since that is the nature of the failure.
This commit is contained in:
parent
5dc3bbcddd
commit
2578fd5817
@ -27,7 +27,10 @@ pluginmap = {}
|
||||
|
||||
|
||||
def nested_lookup(nestdict, key):
|
||||
return reduce(dict.__getitem__, key, nestdict)
|
||||
try:
|
||||
return reduce(dict.__getitem__, key, nestdict)
|
||||
except TypeError:
|
||||
raise exc.NotFoundException("Invalid element requested")
|
||||
|
||||
|
||||
def load_plugins():
|
||||
@ -155,6 +158,8 @@ def enumerate_node_collection(collectionpath, configmanager):
|
||||
raise exc.NotFoundException("Invalid element requested")
|
||||
del collectionpath[0:2]
|
||||
collection = nested_lookup(noderesources, collectionpath)
|
||||
if not isinstance(collection, dict):
|
||||
raise exc.NotFoundException("Invalid element requested")
|
||||
return iterate_resources(collection)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user