forked from extern/nushell
Convert PluginFailedToDecode to named fields (#11126)
# Description Part of #10700 # User-Facing Changes None # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting N/A
This commit is contained in:
@@ -326,7 +326,9 @@ pub fn serve_plugin(plugin: &mut impl Plugin, encoder: impl PluginEncoder) {
|
||||
.map(|custom_value| {
|
||||
Value::custom_value(custom_value, plugin_data.span)
|
||||
})
|
||||
.map_err(|err| ShellError::PluginFailedToDecode(err.to_string()))
|
||||
.map_err(|err| ShellError::PluginFailedToDecode {
|
||||
msg: err.to_string(),
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
@@ -362,7 +364,9 @@ pub fn serve_plugin(plugin: &mut impl Plugin, encoder: impl PluginEncoder) {
|
||||
}
|
||||
PluginCall::CollapseCustomValue(plugin_data) => {
|
||||
let response = bincode::deserialize::<Box<dyn CustomValue>>(&plugin_data.data)
|
||||
.map_err(|err| ShellError::PluginFailedToDecode(err.to_string()))
|
||||
.map_err(|err| ShellError::PluginFailedToDecode {
|
||||
msg: err.to_string(),
|
||||
})
|
||||
.and_then(|val| val.to_base_value(plugin_data.span))
|
||||
.map(Box::new)
|
||||
.map_err(LabeledError::from)
|
||||
|
Reference in New Issue
Block a user