Skip to content

Refactor/api client error handling#25

Merged
lewiszlw merged 3 commits intomasterfrom
refactor/api-client-error-handling
Apr 24, 2026
Merged

Refactor/api client error handling#25
lewiszlw merged 3 commits intomasterfrom
refactor/api-client-error-handling

Conversation

@lewiszlw
Copy link
Copy Markdown
Member

Background

Based on the corrected test reports, it was confirmed that the API returns {} for successful sends, and uses specific integer codes for business failures.

Refactoring Content

  • Unified the API request pipeline by introducing a generic
    equest method to consolidate the HTTP execution flow, removing redundancy in post_json and post_form.
  • Improved error handling to be more explicit and actionable.

Error Message Improvements

et: -2 $\rightarrow$ Invalid context token

et: -3 $\rightarrow$ User ID mismatch or not found

  • errcode: -14 $\rightarrow$ Session expired

Verification

  • cargo fmt --check ✅
  • cargo check ✅
  • cargo test ✅ (All 26 tests passed)

@lewiszlw lewiszlw merged commit 382072d into master Apr 24, 2026
3 checks passed
@lewiszlw lewiszlw deleted the refactor/api-client-error-handling branch April 24, 2026 16:29
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.

1 participant