Skip to content

[lib-chat] Enhance error handling and message formatting#23

Merged
linmx0130 merged 2 commits intomainfrom
error-refactor
Aug 3, 2025
Merged

[lib-chat] Enhance error handling and message formatting#23
linmx0130 merged 2 commits intomainfrom
error-refactor

Conversation

@linmx0130
Copy link
Copy Markdown
Owner

  1. Move error types in nah_chat to an independent file.
  2. Improves error message readability by using "caused by" instead of "source"
  3. Adds automatic conversion of reqwest errors to nah_chat custom Error type
  4. Simplifies network error handling code using Rust's try operator (?)
  5. Updates error formatting to display causes when present

- Extracted `ErrorKind`, `Error`, and `Result` types into a new `error.rs` module
- Moved previous error implementation from `lib.rs` to `error.rs`
- Added `pub use` statements in `lib.rs` to re-export the error types
1. Improves error message readability by using "caused by" instead of "source"
2. Adds automatic conversion of reqwest errors to nah_chat custom Error type
3. Simplifies network error handling code using Rust's try operator (?)
4. Updates error formatting to display causes when present
@linmx0130 linmx0130 merged commit 707c95f into main Aug 3, 2025
1 check passed
@linmx0130 linmx0130 deleted the error-refactor branch August 3, 2025 18:52
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