Report a login failure from the CLI as a readable error - #4053
Merged
nellh merged 1 commit intoAug 12, 2026
Conversation
Creating a dataset without valid credentials produced two unhelpful outcomes. The server error array was stringified whole, so the one line that matters was buried in a server side stacktrace, and a response carrying a null createDataset field made createDataset resolve to undefined, which only failed later as "Path must be a string, received undefined" from the path join in the upload command. Keep only the GraphQL messages, raise a LoginError naming the command that fixes it when the failure is an authentication one, and reject a response that carries no accession number. The upload command now prints that message and stops instead of throwing an uncaught error. Fixes OpenNeuroOrg#3523
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4053 +/- ##
==========================================
+ Coverage 48.89% 49.04% +0.15%
==========================================
Files 686 686
Lines 38069 38093 +24
Branches 1894 1906 +12
==========================================
+ Hits 18615 18684 +69
+ Misses 19293 19242 -51
- Partials 161 167 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
nellh
approved these changes
Aug 12, 2026
nellh
left a comment
Contributor
There was a problem hiding this comment.
Thanks for your contribution.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3523.
Creating a dataset without valid credentials produced two unhelpful outcomes, both visible in the tracebacks on the issue.
First,
createDatasetstringified the whole GraphQLerrorsarray, so the one line that matters, "You must be logged in to create a dataset.", was buried in a server side stacktrace.Second, a response carrying
data.createDataset: nullwith no top level errors madecreateDatasetresolve toundefineddespite itsPromise<string>type. That only failed much later asTypeError: Path must be a string, received "undefined"from thejoin(repoDir, datasetId)inupload.ts, which points the user at a path problem rather than at their credentials.Only the GraphQL messages are kept now. An authentication failure raises
LoginErrornaming the command that fixes it, and a response with no accession number is rejected where it happens instead of turning into a path error later.getLatestSnapshotVersionshares the same handling. The upload command prints that message and stops rather than throwing an uncaught error.Reverting
graphq.tsandupload.tsgives 1 passed and 4 failed: the no accession number case resolvedundefinedwithout throwing, the missing credentials case gave aResponseErrorinstead of aLoginError, and both message filtering cases returned the raw JSON array. After, the full CLI suite is green at 41 passed across 12 steps, withdeno fmtanddeno lintclean.One note for anyone running this locally.
cli/deno.jsonhas"minimumDependencyAge": {"exclude": [...]}, which deno 2.6.10 rejects withUnsupported "minimumDependencyAge" object. Caused by: missing field 'age'. I dropped the key locally to run the tests and restored it before committing, so this branch does not touch it. CI pinsdeno-version: v2.x, so this may start biting soon.Disclosure: this change was prepared with AI assistance. I have reviewed and tested it.