co_primitives/types/
diagnostic_message.rs1use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Clone, Serialize, Deserialize)]
7pub enum DiagnosticMessage {
8 Failure(String),
13}
14impl DiagnosticMessage {
15 pub fn to_error(&self) -> Option<anyhow::Error> {
16 match self {
17 DiagnosticMessage::Failure(diagnostic) => Some(anyhow::anyhow!(diagnostic.clone())),
18 }
19 }
20}
21impl From<anyhow::Error> for DiagnosticMessage {
22 fn from(value: anyhow::Error) -> Self {
23 DiagnosticMessage::Failure(format!("{:?}", value))
24 }
25}