Skip to content

Commit

Permalink
remove use of bare unwrap() in error propagation (#600)
Browse files Browse the repository at this point in the history
  • Loading branch information
kalvinnchau authored Jan 16, 2025
1 parent 4e0d803 commit 4860adb
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions crates/mcp-client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ where
.call(request)
.await
.map_err(|e| Error::McpServerError {
server: self.server_info.as_ref().unwrap().name.clone(),
server: self
.server_info
.as_ref()
.map(|s| s.name.clone())
.unwrap_or("".to_string()),
method: method.to_string(),
// we don't need include params because it can be really large
source: Box::new(e.into()),
Expand Down Expand Up @@ -205,7 +209,11 @@ where
.call(notification)
.await
.map_err(|e| Error::McpServerError {
server: self.server_info.as_ref().unwrap().name.clone(),
server: self
.server_info
.as_ref()
.map(|s| s.name.clone())
.unwrap_or("".to_string()),
method: method.to_string(),
// we don't need include params because it can be really large
source: Box::new(e.into()),
Expand Down

0 comments on commit 4860adb

Please sign in to comment.