mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-07-22 05:25:14 +08:00
为 issue #1 的公共错误契约建立错误码模型: - core/src/error_code.rs:ErrorCode(BAT-ERR-<域3位><序号3位>,如 BAT-ERR-300012) + 44 个初始码表(覆盖输入/路径安全/网络下载/校验/发布存储/解析/任务RPC/内部 八域,网络域含代理故障 310001)、ErrorDomain、以及进入 RPC envelope / --json / bat-events.jsonl 的统一 ApiError { code, kind, domain, location, message, retryable }。 location 用稳定的组件·操作标签(不随行号漂移)。 - 新增 USERGUIDE.md:bat 命令、选项(发现/同步/守护/输出)、退出码(含 75=locked)、 运行时默认值,以及从码表同步的错误码参考(含承载结构与域一览)。 命名遵循国际惯例(英文 kind/domain slug)。码表以 error_code.rs 为准,USERGUIDE 错误码表与之逐条一致。后续各链路报错接入该码表在 issue #1 下推进。 对应 issue #1(错误码模型 + 用户指南)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
39 lines
815 B
Rust
39 lines
815 B
Rust
//! # BAT Core - 核心领域层
|
||
//!
|
||
//! BlueArchive Toolkit 的核心领域模型和业务逻辑
|
||
//!
|
||
//! 本模块包含:
|
||
//! - 领域对象(Domain Objects)
|
||
//! - 仓储接口(Repository Interfaces)
|
||
//! - 领域服务(Domain Services)
|
||
//!
|
||
//! 设计原则:
|
||
//! - 领域层不依赖任何外部技术细节
|
||
//! - 所有依赖通过接口注入
|
||
//! - 纯粹的业务逻辑
|
||
|
||
#![warn(missing_docs)]
|
||
#![warn(clippy::all)]
|
||
|
||
pub mod domain;
|
||
pub mod error;
|
||
pub mod error_code;
|
||
pub mod repositories;
|
||
pub mod services;
|
||
|
||
pub use error::{Error, Result};
|
||
pub use error_code::{ApiError, ErrorCode, ErrorDomain};
|
||
|
||
/// Core 版本号
|
||
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||
|
||
#[cfg(test)]
|
||
mod tests {
|
||
use super::*;
|
||
|
||
#[test]
|
||
fn test_version() {
|
||
assert!(!VERSION.is_empty());
|
||
}
|
||
}
|