Skip to content

fix: gracefully handle corrupted keypair files in keys list - #28

Open
MayurK-cmd wants to merge 1 commit into
jup-ag:mainfrom
MayurK-cmd:fix/keys-list-graceful-error-handling
Open

fix: gracefully handle corrupted keypair files in keys list#28
MayurK-cmd wants to merge 1 commit into
jup-ag:mainfrom
MayurK-cmd:fix/keys-list-graceful-error-handling

Conversation

@MayurK-cmd

Copy link
Copy Markdown

fix: gracefully handle corrupted keypair files in keys list

Previously, if any keypair file was corrupted or unreadable, the entire
'keys list' command would crash due to Promise.all() rejecting on first
error. Now uses Promise.allSettled() to:

  • Load all valid keys
  • Collect errors from failed keys
  • Display warning with list of problematic keys
  • Return successfully with all loadable keys displayed

Changes:

  • Replace Promise.all() with Promise.allSettled() in KeysCommand.list()
  • Extract fulfilled results into keypairData array
  • Track and warn about rejected promises
  • Add e2e test verifying command succeeds even with corrupted files

Fixes: #23

Previously, if any keypair file was corrupted or unreadable, the entire
'keys list' command would crash due to Promise.all() rejecting. Now uses
Promise.allSettled() to load all valid keys and warn about failed ones.

Changes:
- Replace Promise.all() with Promise.allSettled()
- Track failed keys and display warning message
- Add e2e test verifying command succeeds with corrupted files present
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.

keys list crashes if any keypair file is corrupted

1 participant