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

Method message

datafusion/common/src/error.rs:540–589  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

538 }
539
540 pub fn message(&self) -> Cow<'_, str> {
541 match *self {
542 DataFusionError::ArrowError(ref desc, ref backtrace) => {
543 let backtrace = backtrace.clone().unwrap_or_else(|| "".to_owned());
544 Cow::Owned(format!("{desc}{backtrace}"))
545 }
546 #[cfg(feature = "parquet")]
547 DataFusionError::ParquetError(ref desc) => Cow::Owned(desc.to_string()),
548 DataFusionError::IoError(ref desc) => Cow::Owned(desc.to_string()),
549 #[cfg(feature = "sql")]
550 DataFusionError::SQL(ref desc, ref backtrace) => {
551 let backtrace: String =
552 backtrace.clone().unwrap_or_else(|| "".to_owned());
553 Cow::Owned(format!("{desc:?}{backtrace}"))
554 }
555 DataFusionError::Configuration(ref desc) => Cow::Owned(desc.to_string()),
556 DataFusionError::NotImplemented(ref desc) => Cow::Owned(desc.to_string()),
557 DataFusionError::Internal(ref desc) => Cow::Owned(format!(
558 "{desc}.\nThis issue was likely caused by a bug in DataFusion's code. \
559 Please help us to resolve this by filing a bug report in our issue tracker: \
560 https://github.com/apache/datafusion/issues"
561 )),
562 DataFusionError::Plan(ref desc) => Cow::Owned(desc.to_string()),
563 DataFusionError::SchemaError(ref desc, ref backtrace) => {
564 let backtrace: &str =
565 &backtrace.as_ref().clone().unwrap_or_else(|| "".to_owned());
566 Cow::Owned(format!("{desc}{backtrace}"))
567 }
568 DataFusionError::Execution(ref desc) => Cow::Owned(desc.to_string()),
569 DataFusionError::ExecutionJoin(ref desc) => Cow::Owned(desc.to_string()),
570 DataFusionError::ResourcesExhausted(ref desc) => Cow::Owned(desc.to_string()),
571 DataFusionError::External(ref desc) => Cow::Owned(desc.to_string()),
572 #[cfg(feature = "object_store")]
573 DataFusionError::ObjectStore(ref desc) => Cow::Owned(desc.to_string()),
574 DataFusionError::Context(ref desc, ref err) => {
575 Cow::Owned(format!("{desc}\ncaused by\n{}", *err))
576 }
577 DataFusionError::Substrait(ref desc) => Cow::Owned(desc.to_string()),
578 DataFusionError::Diagnostic(_, ref err) => Cow::Owned(err.to_string()),
579 // Returning the message of the first error is probably fine enough,
580 // and makes `DataFusionError::Collection` a transparent wrapped,
581 // unless the end user explicitly calls `DataFusionError::iter`.
582 DataFusionError::Collection(ref errs) => errs
583 .first()
584 .expect("cannot construct DataFusionError::Collection with 0 errors")
585 .message(),
586 DataFusionError::Shared(ref desc) => Cow::Owned(desc.to_string()),
587 DataFusionError::Ffi(ref desc) => Cow::Owned(desc.to_string()),
588 }
589 }
590
591 /// Wraps the error with contextual information intended for end users
592 pub fn with_diagnostic(self, diagnostic: Diagnostic) -> Self {

Callers 9

clientFunction · 0.80
update_slow_countMethod · 0.80
update_slow_countMethod · 0.80
update_slow_countMethod · 0.80
fmtMethod · 0.80
test_try_cmpFunction · 0.80

Calls 4

cloneMethod · 0.45
to_stringMethod · 0.45
as_refMethod · 0.45
firstMethod · 0.45

Tested by 4

test_try_cmpFunction · 0.64