From 9a483a0b0ec66d6660fdcababf9bd71a814f75d2 Mon Sep 17 00:00:00 2001 From: Arda Aydin Date: Sat, 19 Sep 2026 14:19:24 +0300 Subject: [PATCH] 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 --- app_state.py | 2 +- dasp.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) 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