summaryrefslogtreecommitdiff
path: root/cli/diagnostics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/diagnostics.rs')
-rw-r--r--cli/diagnostics.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/cli/diagnostics.rs b/cli/diagnostics.rs
index 69b58459e..14f5ba2c4 100644
--- a/cli/diagnostics.rs
+++ b/cli/diagnostics.rs
@@ -7,6 +7,7 @@ use crate::fmt_errors::format_maybe_source_name;
use crate::fmt_errors::DisplayFormatter;
use serde_json;
use serde_json::value::Value;
+use std::error::Error;
use std::fmt;
#[derive(Debug, PartialEq, Clone)]
@@ -66,6 +67,12 @@ impl fmt::Display for Diagnostic {
}
}
+impl Error for Diagnostic {
+ fn description(&self) -> &str {
+ &self.items[0].message
+ }
+}
+
#[derive(Debug, PartialEq, Clone)]
pub struct DiagnosticItem {
/// The top level message relating to the diagnostic item.