Skip to content

Enhance upload/download operation error messages#1793

Open
yarikoptic-gitmate wants to merge 4 commits intomasterfrom
enh-lad-errors-operations
Open

Enhance upload/download operation error messages#1793
yarikoptic-gitmate wants to merge 4 commits intomasterfrom
enh-lad-errors-operations

Conversation

@yarikoptic-gitmate
Copy link
Collaborator

Improves upload and download error messages with diagnostic hints for quick issue resolution.

Changes

  • File not found: Adds file path context
  • Failed validation: References dandi validate command for details
  • Failed to compute digest: Suggests checking file readability and corruption
  • Failed to extract metadata: Explains NWB specification requirements
  • No URLs provided: Shows example usage for download command

Example Improvements

Before:

NotImplementedError: No URLs were provided. Cannot download anything

After:

NotImplementedError: No URLs were provided. Cannot download anything.
Provide a DANDI URL (e.g., 'dandi download DANDI:000027')
or use '--download' with a dandiset URL.

Benefits

  • Users get specific guidance for upload/download issues
  • References validation commands for more details
  • Provides example usage

Files Changed

  • dandi/upload.py
  • dandi/download.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 upload.py/download.py but in different parts of the files.

See commit: 64a04262

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

Improve error messages in upload.py and download.py to provide clearer guidance:
- Add file path context to "File not found" errors
- Reference 'dandi validate' command for validation failures
- Suggest checking file format and corruption for digest errors
- Explain NWB specification requirements for metadata extraction
- Provide example usage for download command when no URLs given

These improvements help users quickly diagnose and fix upload/download 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 20.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.12%. Comparing base (830debb) to head (d0a3021).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
dandi/upload.py 25.00% 3 Missing ⚠️
dandi/download.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1793   +/-   ##
=======================================
  Coverage   75.11%   75.12%           
=======================================
  Files          84       84           
  Lines       11922    11922           
=======================================
+ Hits         8955     8956    +1     
+ Misses       2967     2966    -1     
Flag Coverage Δ
unittests 75.12% <20.00%> (+<0.01%) ⬆️

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.

@yarikoptic yarikoptic added the patch Increment the patch version when merged label Feb 13, 2026
Comment on lines +111 to +115
raise NotImplementedError(
"No URLs were provided. Cannot download anything. "
"Provide a DANDI URL (e.g., 'dandi download DANDI:000027') "
"or use '--download' with a dandiset URL."
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Not to be changed here per se, but wanted to point out this lovely linting check I ran into a while back and have gotten into the matter of using on all my projects

https://docs.astral.sh/ruff/rules/raw-string-in-exception/

@CodyCBakerPhD
Copy link
Contributor

No code changes. Only text.

Latest text reads well and adds more detail

@CodyCBakerPhD
Copy link
Contributor

@yarikoptic Unable to merge b/c your previous review was blocking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request patch Increment the patch version when merged UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants