Skip to content
Snippets Groups Projects
Commit 496c4e8f authored by jkerdreu's avatar jkerdreu
Browse files

Remove exceptions from code to add a exceptions.py

git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/fork@1775 b32b6428-25c9-4566-ad07-03861ab6144f
parent 483fb057
No related branches found
No related tags found
No related merge requests found
......@@ -11,4 +11,4 @@ from . import config
from .core import Engine
from .devices import Device
from .devices import Attribute
from .exceptions import *
......@@ -21,8 +21,8 @@
#
from .network import NetworkConnector
from .messages import MessageFactory, MessageParserError
from .devices import DeviceError, XAALError
from .messages import MessageFactory
from .exceptions import DeviceError, XAALError,MessageParserError
from . import config
from . import tools
......@@ -273,9 +273,6 @@ class Engine(object):
# Process attributes change for devices
self.process_attributesChange()
# Process Callbacks
self.process_callbacks()
# Process timers
self.process_timers()
......@@ -377,14 +374,6 @@ def get_args_method(method):
pass
return spec.args
class XAALEngineError:pass
class CallbackError(Exception):
def __init__(self, code, desc):
self.code = code
self.description = desc
class Timer(object):
def __init__(self,func,period):
......
......@@ -23,16 +23,13 @@
from . import config
from . import tools
from .exceptions import DeviceError
import logging
logger = logging.getLogger(__name__)
import time
class DeviceError(Exception):pass
class XAALError(Exception):pass
class Attribute(object):
def __init__(self, name, dev=None, default=None):
......
# devices.py
class DeviceError(Exception):pass
# core.py
class XAALError(Exception):pass
class CallbackError(Exception):
def __init__(self, code, desc):
self.code = code
self.description = desc
# messages.py
class MessageParserError(Exception):pass
class MessageError(Exception):pass
__all__ = ["DeviceError","XAALError","CallbackError","MessageParserError","MessageError"]
......@@ -25,6 +25,7 @@ from __future__ import print_function
from . import tools
from . import config
from .exceptions import MessageError,MessageParserError
import ujson as json
import datetime
......@@ -37,11 +38,6 @@ import logging
logger = logging.getLogger(__name__)
class MessageParserError(Exception):pass
class MessageError(Exception):pass
class MessageFactory(object):
"""Message Factory:
- Build xAAL message
......@@ -136,7 +132,7 @@ class MessageFactory(object):
try:
payload = json.loads(pjson)
except:
raise MessageFactoryParserError("Unable to parse JSON data in payload after decrypt")
raise MessageParserError("Unable to parse JSON data in payload after decrypt")
# Message unpacking header
if 'header' in payload:
......@@ -374,4 +370,3 @@ if sys.version_info.major == 2:
_packtimestamp = lambda t1,t2: [long(t1),int(t2)]
else:
_packtimestamp = lambda t1,t2: [int(t1),int(t2)]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment