Skip to content

Enhance API client error messages#1791

Merged
CodyCBakerPhD merged 8 commits intomasterfrom
enh-lad-errors-api
Feb 14, 2026
Merged

Enhance API client error messages#1791
CodyCBakerPhD merged 8 commits intomasterfrom
enh-lad-errors-api

Conversation

@yarikoptic-gitmate
Copy link
Collaborator

Improves API client error messages with clearer guidance for troubleshooting access issues.

Changes

  • Mutually exclusive parameters: Explains proper usage of api_url vs dandi_instance
  • Dandiset not found: Suggests verifying ID, checking permissions, and provides web UI link
  • Asset not found: References dandi ls command and includes version context

Example Improvements

Before:

NotFoundError: No asset at path 'data/file.nwb'

After:

NotFoundError: No asset at path 'data/file.nwb' in version draft.
Verify the path is correct and the asset exists in this version.
Use 'dandi ls' to list available assets.

Benefits

  • Clearer guidance for API access issues
  • References specific commands for troubleshooting
  • Includes version context to help users understand scope

Files Changed

  • dandi/dandiapi.py

Testing

Verified with full test suite: 548 passed, 0 failed.

Note: This PR may have minor conflicts with # if that hasn't merged yet. Both add docstrings and improve errors in dandiapi.py but in different parts of the file.

See commit: cea29d0c

Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com

Improve error messages in dandiapi.py to provide clearer guidance:
- Explain mutually exclusive api_url/dandi_instance parameters
- Add hint to verify Dandiset ID and check permissions
- Reference 'dandi ls' command for listing assets
- Include version context in "No asset at path" errors

These improvements help users quickly troubleshoot API access issues.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@yarikoptic-gitmate yarikoptic-gitmate added enhancement New feature or request UX labels Feb 12, 2026
@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

❌ Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 75.12%. Comparing base (0c60106) to head (a80426b).
⚠️ Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
dandi/dandiapi.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1791   +/-   ##
=======================================
  Coverage   75.12%   75.12%           
=======================================
  Files          84       84           
  Lines       11922    11922           
=======================================
  Hits         8956     8956           
  Misses       2966     2966           
Flag Coverage Δ
unittests 75.12% <92.30%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@CodyCBakerPhD
Copy link
Contributor

@copilot Please add single apostrophe quotes around all variables in the error messages for consistency

Copy link
Contributor

Copilot AI commented Feb 13, 2026

@CodyCBakerPhD I've opened a new pull request, #1798, to work on those changes. Once the pull request is ready, I'll request review from you.

@CodyCBakerPhD
Copy link
Contributor

Only one minor gripe above otherwise more words to read when something fails

Comment on lines +439 to +440
"api_url and dandi_instance are mutually exclusive. "
"Use either 'api_url' to specify a custom API URL, "
Copy link
Contributor

Choose a reason for hiding this comment

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

More inconsistency to fix in follow-up

@CodyCBakerPhD
Copy link
Contributor

No code changes. Only text.

Latest text reads well and adds more detail

@CodyCBakerPhD
Copy link
Contributor

@copilot Need to fix various test outputs that utilize the altered error messages

Copy link
Contributor

Copilot AI commented Feb 14, 2026

@CodyCBakerPhD I've opened a new pull request, #1801, to work on those changes. Once the pull request is ready, I'll request review from you.

@CodyCBakerPhD CodyCBakerPhD added the internal Changes only affect the internal API label Feb 14, 2026
@CodyCBakerPhD CodyCBakerPhD merged commit c58bd37 into master Feb 14, 2026
62 of 64 checks passed
@CodyCBakerPhD CodyCBakerPhD deleted the enh-lad-errors-api branch February 14, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request internal Changes only affect the internal API UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants