diff --git a/app_state.py b/app_state.py index 5fca619..1bf609e 100644 --- a/app_state.py +++ b/app_state.py @@ -8,7 +8,7 @@ so later rebinding would only ever be seen by the module that did it. import configparser import os -VERSION = "0.0.0.102" +VERSION = "0.0.0.103" PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties") DEFAULT_GRID_SIZE = 10 DEFAULT_ADD_TIMESTAMP = True diff --git a/dasp.py b/dasp.py index e20acb0..3b39140 100644 --- a/dasp.py +++ b/dasp.py @@ -101,9 +101,18 @@ def _trace(direction, msg, datagram=None): print(f"[DASP] {ts} {direction} {name}{seq}{ack} payload={plen}{hexdump}") +_ERROR_HINTS = { + ERR_NOT_AUTHENTICATED: " - check username and password", + ERR_BUSY: " - device is busy", + ERR_INCOMPATIBLE_VERSION: " - incompatible protocol version", + ERR_DIGEST_NOT_SUPPORTED: " - digest algorithm not supported", +} + + class DaspException(Exception): def __init__(self, msg, error_code=-1): - super().__init__(msg) + hint = _ERROR_HINTS.get(error_code, "") + super().__init__(msg + hint) self.error_code = error_code