feat: add source and public protocol inputs

This commit is contained in:
cflmy committed 2026-11-23 16:58:12 +08:00
1 parent 68b14db095
commit e67697be06
30 files changed
+3021

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
use std::path::PathBuf;
#[derive(Debug, thiserror::Error)]
pub enum LintError {
#[error("无法读取 {path}: {source}")]
Io {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("{path} 不是有效 UTF-8:{source}")]
Utf8 {
path: PathBuf,
#[source]
source: std::str::Utf8Error,
},
#[error("协议错误:{0}")]
Protocol(String),
#[error("Marqdo 核心调用失败:{0}")]
Core(String),
#[error("配置错误:{0}")]
Config(String),
}
pub type Result<T> = std::result::Result<T, LintError>;
pub fn io(path: impl Into<PathBuf>, source: std::io::Error) -> LintError {
LintError::Io {
path: path.into(),
source,
}
}