1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//! Error types for the `tga-core` crate.
//!
//! All library code in this crate returns [`Result<T>`], which is a type alias
//! for `std::result::Result<T, TgaError>`. Errors implement `std::error::Error`
//! via [`thiserror::Error`] so they integrate cleanly with both `anyhow`
//! (in binary crates) and direct error matching.
use Error;
/// Top-level error type for all `tga-core` operations.
///
/// Why: every fallible library call in `tga::core` must return a single
/// uniform error so the binary can use `?` with `anyhow::Result` and
/// keep the call sites readable.
/// What: a `thiserror`-derived enum with `From` impls for the common
/// failure sources (rusqlite, std::io, serde_yaml, serde_json) plus
/// domain-specific variants for config / validation / migration / lookup
/// failures.
/// Test: covered indirectly — any test exercising config or DB load paths
/// produces these variants on failure (see `core::tests::config_validate_*`).
///
/// Variants intentionally cover the surface area of I/O, serialization,
/// database, migration, validation, and lookup failures. Add new variants
/// rather than overloading [`TgaError::ValidationError`] for unrelated
/// failure modes.
/// Crate-wide `Result` alias.
///
/// Why: keep function signatures compact — typing `Result<T>` is shorter
/// than `std::result::Result<T, TgaError>` and lets readers focus on `T`.
/// What: `std::result::Result<T, TgaError>` re-exported from this module.
/// Test: type alias only — exercised by every function in the crate.
///
/// Prefer `tga_core::Result<T>` over `std::result::Result<T, TgaError>`
/// for brevity in signatures.
pub type Result<T> = Result;