From 05df02af035d46ee0f4ac028845173ac789f3e10 Mon Sep 17 00:00:00 2001 From: sidya82 Date: Mon, 3 Mar 2014 00:34:30 +0100 Subject: [PATCH] =?UTF-8?q?=09modifi=C3=A9:=20=20=20=20=20=20=20=20=20m/lo?= =?UTF-8?q?adConf.py=20=09modifi=C3=A9:=20=20=20=20=20=20=20=20=20superTor?= =?UTF-8?q?nado.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- m/loadConf.py | 8 +++++++- superTornado.py | 11 ++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/m/loadConf.py b/m/loadConf.py index c80f31d..43d67f8 100644 --- a/m/loadConf.py +++ b/m/loadConf.py @@ -27,7 +27,11 @@ class LoadConf(object): def portServ(self) : return self.loadValue("portServ") - +class ConfigError(Exception): + def __init__(self, value): + self.value = value + def __str__(self): + return repr(self.value) class bcolors: HEADER = '\033[95m' @@ -44,3 +48,5 @@ class bcolors: self.WARNING = '' self.FAIL = '' self.ENDC = '' + + diff --git a/superTornado.py b/superTornado.py index b5883a3..b684c62 100644 --- a/superTornado.py +++ b/superTornado.py @@ -161,15 +161,16 @@ if __name__ == "__main__": portCamera = config.portCamera() portServ = config.portServ() if blind == "error" : - raise BlindERROR("l") + raise ConfigError("Failed Load Blind Configuration") if ipCamera == "error" : - raise IPCameraERROR("b") + raise ConfigError("Failed Load IP Camera Configuration") if portCamera == "error" : - raise PortCamERROR("c") + raise ConfigError("Failed Load IP Camera Configuration") if portServ == "error" : - raise PortServERROR("e") - except PortServERROR as e : + raise ConfigError("Failed Load Port Server Configuration") + except ConfigError as e : print bcolors.FAIL + print e print "Configuration Loading Failed ! Check Configuration File !" + bcolors.ENDC sys.exit(1) print "->Configuration Server Load Successfully :"