diff --git a/confluent/config/configmanager.py b/confluent/config/configmanager.py index 3623b6aa..da8009cf 100644 --- a/confluent/config/configmanager.py +++ b/confluent/config/configmanager.py @@ -46,7 +46,6 @@ from Crypto.Hash import SHA256 import array import ast import collections -import confluent.config.crypto as crypto import confluent.util import copy import cPickle diff --git a/confluent/exceptions.py b/confluent/exceptions.py new file mode 100644 index 00000000..d8787d9c --- /dev/null +++ b/confluent/exceptions.py @@ -0,0 +1,5 @@ +class ConfluentException(Exception): + pass + +class NotFoundException(ConfluentException): + pass diff --git a/confluent/httpapi.py b/confluent/httpapi.py index 58bc28dc..d5a7741d 100644 --- a/confluent/httpapi.py +++ b/confluent/httpapi.py @@ -7,6 +7,7 @@ import base64 import Cookie import confluent.auth as auth import confluent.consoleserver as consoleserver +import confluent.exceptions as exc import confluent.pluginapi as pluginapi import confluent.util as util import eventlet @@ -192,13 +193,13 @@ def resourcehandler(env, start_response): yield rsp return else: - start_response('200 OK', headers) try: hdlr = pluginapi.handle_path(env['PATH_INFO'], 'retrieve', cfgmgr) - except: + except exc.NotFoundException: start_response('404 Not found', headers) yield "404 - Request path not recognized" return + start_response('200 OK', headers) for rsp in hdlr: yield rsp.json() diff --git a/confluent/pluginapi.py b/confluent/pluginapi.py index d4f6abc8..d7b405e0 100644 --- a/confluent/pluginapi.py +++ b/confluent/pluginapi.py @@ -18,6 +18,7 @@ # see API.txt import confluent.interface.console as console +import confluent.exceptions as exc import os import sys @@ -106,7 +107,7 @@ def handle_path(path, operation, configmanager): else: return stripnode(passvalue, node) else: - raise Exception("TODO: notfoundexception") + raise exc.NotFoundException()