use crate::sessions::{Session, SessionEventKind, record_session_event};
use anyhow::Result;
use serde_json::json;
use std::path::Path;
pub(super) fn record_error(session: Option<&Session>, cwd: &Path, message: &str) -> Result<()> {
record_session_event(
session,
cwd,
SessionEventKind::Diagnostic,
json!({"level":"error", "message": message}),
)
.map(|_| ())
}