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:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user