You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
response
.text().await.map_err(|e| format!("Failed to get response body as text: {e}")).and_then(|text| {
serde_json::from_str::<Value>(&text).map(|v| v["error"]["message"].to_string()).map_err(|e| format!("Failed to parse error response: {e}"))}).unwrap(),
The above code should produce a String thereby never panicking. The map_err calls already convert any error into a String, therefore we should use .unwrap_or_else(identity) instead of .unwrap.
(https://github.com/hseeberger/pub-sub-client/blob/main/pub-sub-client/src/error/mod.rs#L41)
If either
text().await
orserde_json::from_str
returns anErr
,unwrap
will panic.The text was updated successfully, but these errors were encountered: