MCPcopy Create free account
hub / github.com/apache/datafusion / error_or

Method error_or

datafusion/common/src/error.rs:743–749  ·  view source on GitHub ↗

Returns `Ok(ok)` if no errors were added to the builder, otherwise returns a `Result::Err`

(self, ok: T)

Source from the content-addressed store, hash-verified

741 /// Returns `Ok(ok)` if no errors were added to the builder,
742 /// otherwise returns a `Result::Err`
743 pub fn error_or<T>(self, ok: T) -> Result<T, DataFusionError> {
744 match self.0.len() {
745 0 => Ok(ok),
746 1 => Err(self.0.into_iter().next().expect("length matched 1")),
747 _ => Err(DataFusionError::Collection(self.0)),
748 }
749 }
750}
751
752/// Unwrap an `Option` if possible. Otherwise return an `DataFusionError::Internal`.

Callers 1

prepare_select_exprsMethod · 0.80

Calls 3

lenMethod · 0.45
nextMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected