From adf52517fda5a95a4a2a734cf6bb003196f0ff6d Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 15 Oct 2013 21:13:48 -0400 Subject: [PATCH] More cleanly handle unrecognized urls --- confluent/httpapi.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/confluent/httpapi.py b/confluent/httpapi.py index 06fc3bfb..a501de5a 100644 --- a/confluent/httpapi.py +++ b/confluent/httpapi.py @@ -193,7 +193,13 @@ def resourcehandler(env, start_response): return else: start_response('200 OK', headers) - for rsp in pluginapi.handle_path(env['PATH_INFO'], 'retrieve', cfgmgr): + try: + hdlr = pluginapi.handle_path(env['PATH_INFO'], 'retrieve', cfgmgr) + except: + start_response('404 Not found', headers) + yield "404 - Request path not recognized" + return + for rsp in hdlr: yield json.dumps(rsp, separators=(',', ':'))