diff --git a/r2r/src/error.rs b/r2r/src/error.rs index 389653777..6518da77e 100644 --- a/r2r/src/error.rs +++ b/r2r/src/error.rs @@ -128,9 +128,6 @@ pub enum Error { #[error("Parameter {name} conversion failed: {msg}")] ParameterValueConv { name: String, msg: String }, - #[error("Expected parameter {name} is not set")] - ParameterNotSet { name: String }, - #[error( "Parameter {name} was expected to be of type {expected_type} but was of type {actual_type}" )] diff --git a/r2r/src/nodes.rs b/r2r/src/nodes.rs index cde555bf5..e119f2353 100644 --- a/r2r/src/nodes.rs +++ b/r2r/src/nodes.rs @@ -547,14 +547,13 @@ impl Node { ParameterValue: TryInto, { let params = self.params.lock().unwrap(); - let parameter = params.get(name).ok_or(Error::ParameterNotSet { - name: name.to_string(), - })?; + let value = params + .get(name) + .map(|parameter| parameter.value.clone()) + .unwrap_or(ParameterValue::NotSet); let value: T = - parameter - .value - .clone() + value .try_into() .map_err(|error: WrongParameterType| Error::ParameterWrongType { name: name.to_string(),