Skip to content

Commit 82dd985

Browse files
authored
fix: prevent unexpected_http_status_code from panicking (#12)
1 parent b67e3ad commit 82dd985

File tree

1 file changed

+2
-1
lines changed
  • pub-sub-client/src/error

1 file changed

+2
-1
lines changed

pub-sub-client/src/error/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use reqwest::Response;
22
use serde_json::Value;
3+
use std::convert::identity;
34
use std::error::Error as StdError;
45

56
#[derive(Debug, thiserror::Error)]
@@ -47,7 +48,7 @@ impl Error {
4748
.map(|v| v["error"]["message"].to_string())
4849
.map_err(|e| format!("Failed to parse error response: {e}"))
4950
})
50-
.unwrap(),
51+
.unwrap_or_else(identity),
5152
)
5253
}
5354
}

0 commit comments

Comments
 (0)