Skip to main content

vdsl_sync/infra/
error.rs

1//! Infrastructure error — 外部システム障害。
2//!
3//! DB操作、ファイルハッシュ計算、ストレージバックエンド転送、
4//! シリアライズ、I/O等のインフラ固有エラー。
5//!
6//! アプリケーション層の [`SyncError`](crate::application::error::SyncError) が
7//! `#[from]` でこのエラーを包含する。
8
9use std::path::PathBuf;
10
11/// インフラストラクチャ障害。
12#[derive(Debug, thiserror::Error)]
13pub enum InfraError {
14    #[error("store error ({op}): {reason}")]
15    Store { op: &'static str, reason: String },
16
17    #[error("hash computation failed ({op}): {reason}")]
18    Hash { op: &'static str, reason: String },
19
20    #[error("transfer failed: {reason}")]
21    Transfer { reason: String },
22
23    #[error("file not found: {}", .0.display())]
24    FileNotFound(PathBuf),
25
26    #[error("serialization error: {0}")]
27    Serialization(String),
28
29    #[error("io error: {0}")]
30    Io(#[from] std::io::Error),
31
32    #[error("initialization failed: {0}")]
33    Init(String),
34}