Skip to content

Add ISO15693Error exception for ISO 15693 error responses#15

Merged
bofh69 merged 2 commits intoadd-better-iso15639-supportfrom
copilot/sub-pr-14
Jan 5, 2026
Merged

Add ISO15693Error exception for ISO 15693 error responses#15
bofh69 merged 2 commits intoadd-better-iso15639-supportfrom
copilot/sub-pr-14

Conversation

Copy link
Contributor

Copilot AI commented Jan 5, 2026

Addresses feedback on #14 regarding incomplete error handling for ISO 15693 commands. The TODO comment indicated that error responses should use a dedicated exception type instead of the generic PN5180Error.

Changes

  • Added ISO15693Error exception class to constants.py that captures:

    • Command byte that triggered the error
    • Error code from the tag response
    • Full response data for debugging
  • Updated send_and_receive_15693 to raise ISO15693Error instead of PN5180Error when tags return error responses

  • Exported ISO15693Error from package root for public API

Usage

from pn5180_tagomatic import PN5180Proxy, ISO15693Error, ISO15693Command

reader = PN5180Proxy("/dev/ttyACM0")
try:
    data = reader.send_and_receive_15693(
        ISO15693Command.READ_SINGLE_BLOCK,
        b'\x05'  # block number
    )
except ISO15693Error as e:
    print(f"Command 0x{e.command:02X} failed with code 0x{e.error_code:02X}")
    print(f"Raw response: {e.response_data.hex()}")

Users can now catch ISO 15693-specific errors separately from general PN5180 communication failures and access the complete error response data.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: bofh69 <1444315+bofh69@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on ISO 15693 commands implementation Add ISO15693Error exception for ISO 15693 error responses Jan 5, 2026
Copilot AI requested a review from bofh69 January 5, 2026 20:34
@bofh69 bofh69 marked this pull request as ready for review January 5, 2026 20:36
@bofh69 bofh69 merged commit abdb684 into add-better-iso15639-support Jan 5, 2026
@bofh69 bofh69 deleted the copilot/sub-pr-14 branch January 6, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants