Skip to content

Commit

Permalink
fix: unsafe unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
oddgrd committed Sep 16, 2022
1 parent 1e3f110 commit 6a7b6ba
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion deployer/src/handlers/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ impl Serialize for Error {
{
let mut map = serializer.serialize_map(Some(2))?;
map.serialize_entry("type", &format!("{:?}", self))?;
map.serialize_entry("msg", &self.source().unwrap().to_string())?;
// use the error source if available, if not use display implementation
map.serialize_entry("msg", &self.source().unwrap_or(self).to_string())?;
map.end()
}
}
Expand Down

0 comments on commit 6a7b6ba

Please sign in to comment.