Skip to content

refactor: improve numtracker error messages#1538

Open
shree-iyengar-dls wants to merge 3 commits into
mainfrom
improve_error_message
Open

refactor: improve numtracker error messages#1538
shree-iyengar-dls wants to merge 3 commits into
mainfrom
improve_error_message

Conversation

@shree-iyengar-dls
Copy link
Copy Markdown
Contributor

@shree-iyengar-dls shree-iyengar-dls commented May 8, 2026

Fixes #1507

Summary of changes:

@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.35%. Comparing base (62353cd) to head (c421585).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1538   +/-   ##
=======================================
  Coverage   95.35%   95.35%           
=======================================
  Files          43       43           
  Lines        3205     3209    +4     
=======================================
+ Hits         3056     3060    +4     
  Misses        149      149           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shree-iyengar-dls shree-iyengar-dls marked this pull request as ready for review May 15, 2026 14:36
@shree-iyengar-dls shree-iyengar-dls requested a review from a team as a code owner May 15, 2026 14:36
Copy link
Copy Markdown
Contributor

@tpoliaw tpoliaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. None of the comments are blockers

Comment thread src/blueapi/utils/numtracker.py
for error in json["errors"]:
code = (error.get("extensions") or {}).get("code")

if code == "AUTH_FAILED":
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to improve the error message for the other cases while we're here? Could be a good use for match - something like

match code:
    case "AUTH_FAILED":
        raise ...
    case "AUTH_MISSING":
        raise ...
    case "AUTH_SERVER_ERROR":
        raise ...

and then the fall-through case could be the existing Numtracker error: ... we were previously raising.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yuss that's a good idea thanks

"data": None,
"errors": [
{
"message": "No configuration available for instrument p46",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really minor but having the message match the error might prevent confusion later on

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.

Give better error message on non-existant instrument session

2 participants