-
Notifications
You must be signed in to change notification settings - Fork 0
docs: per-domain typed errors (whatsapp-rust#893) #346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
bcceead
81c96d2
8eccdd6
47fec50
1c49979
a2486c9
79b0872
b6eeae3
e00724b
242fda6
fee3654
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -592,17 +592,29 @@ use wacore::types::events::Event; | |
|
|
||
| ## Error handling | ||
|
|
||
| All methods return `Result<(), anyhow::Error>`. Common errors: | ||
| All methods return `Result<(), AppStateError>`: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This section now says all chat actions return Useful? React with 👍 / 👎. |
||
|
|
||
| - No app state sync key available (sync not complete) | ||
| - Invalid timestamp for `mute_chat_until` | ||
| - Missing `participant_jid` for group star/delete operations | ||
| - Network errors | ||
| ```rust | ||
| #[non_exhaustive] | ||
| pub enum AppStateError { | ||
| #[error("invalid app-state request: {0}")] | ||
| InvalidRequest(String), | ||
| #[error(transparent)] | ||
| Internal(#[from] anyhow::Error), | ||
| } | ||
| ``` | ||
|
|
||
| Common errors: | ||
| - `InvalidRequest` — invalid timestamp for `mute_chat_until`, missing `participant_jid` for group operations | ||
| - `Internal` — no app state sync key available (sync not complete), network errors | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| ```rust | ||
| use whatsapp_rust::AppStateError; | ||
|
|
||
| match client.chat_actions().mute_chat_until(&jid, 0).await { | ||
| Ok(_) => println!("Muted"), | ||
| Err(e) => eprintln!("Failed: {}", e), // Timestamp validation error | ||
| Err(AppStateError::InvalidRequest(msg)) => eprintln!("Validation error: {}", msg), | ||
| Err(e) => eprintln!("Failed: {}", e), | ||
| } | ||
| ``` | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.