Skip to content

feat(errors): improve global error interception for filesystem, network and format errors#35

Merged
MiniMax-AI-Dev merged 2 commits intomainfrom
feat/errors-handler-docs
Apr 6, 2026
Merged

feat(errors): improve global error interception for filesystem, network and format errors#35
MiniMax-AI-Dev merged 2 commits intomainfrom
feat/errors-handler-docs

Conversation

@victor0602
Copy link
Copy Markdown
Collaborator

Summary

  • Add SIGINT handler (exit 130) in main.ts
  • Detect filesystem errors (ENOENT/EACCES/ENOSPC/EPERM/EBUSY/EISDIR/ENOTDIR) with specific hints, plus catch-all for other E prefix Node.js error codes
  • Detect TypeError: fetch failed as network error with MINIMAX_BASE_URL format hint
  • Handle non-JSON API responses gracefully in requestJson
  • Warn when credentials file is corrupted (credentials.ts)
  • Warn when config file is corrupted (loader.ts)
  • Add ERRORS.md documenting all error scenarios for all commands

Test plan

  • Run minimax text chat --message hello and verify error handling works
  • Run with invalid MINIMAX_BASE_URL and verify friendly error
  • Verify ERRORS.md covers all documented error scenarios

…rk and format errors

- Add SIGINT handler (exit 130) in main.ts
- Detect filesystem errors (ENOENT/EACCES/ENOSPC/EPERM/EBUSY/EISDIR/ENOTDIR)
  with specific hints, plus catch-all for other "E" prefix Node.js codes
- Detect TypeError "fetch failed" as network error with MINIMAX_BASE_URL hint
- Handle non-JSON API responses gracefully in requestJson
- Warn when credentials file is corrupted (credentials.ts)
- Warn when config file is corrupted (loader.ts)
- Add ERRORS.md documenting all error scenarios for all commands
@MiniMax-AI-Dev
Copy link
Copy Markdown
Collaborator

这个改动有价值 ,但是 CI 没过

@victor0602
Copy link
Copy Markdown
Collaborator Author

好的,我来处理

The handler.ts uses ExitCode.NETWORK but NETWORK was not defined in the
ExitCode enum, causing TypeScript error TS2339 during CI typecheck.
@victor0602
Copy link
Copy Markdown
Collaborator Author

@MiniMax-AI-Dev Done

@MiniMax-AI-Dev MiniMax-AI-Dev merged commit dc31183 into main Apr 6, 2026
2 checks passed
@RyanLee-Dev RyanLee-Dev deleted the feat/errors-handler-docs branch April 6, 2026 17:56
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.

2 participants