Add descriptive hints to DASP connection errors

Authentication failures now show "check username and password", busy
devices say "device is busy", etc.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-09-19 14:19:24 +03:00
co-authored by Claude Opus 4.6
parent 021361f836
commit 9a483a0b0e
2 changed files with 11 additions and 2 deletions
+1 -1
View File
@@ -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
+10 -1
View File
@@ -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