alpm_db/files/error.rs
1//! Error handling for alpm-db-files.
2
3use fluent_i18n::t;
4
5/// The error that can occur when working with the [alpm-db-files] format.
6///
7/// [alpm-db-files]: https://alpm.archlinux.page/specifications/alpm-db-files.5.html
8#[derive(Debug, thiserror::Error)]
9pub enum Error {
10 /// An [`alpm_common::Error`] occurred.
11 #[error(transparent)]
12 AlpmCommon(#[from] alpm_common::Error),
13
14 /// One or more invalid paths for a [`DbFiles`][`crate::files::DbFiles`] are encountered.
15 #[error("{msg}", msg = t!("error-invalid-files-paths", { "message" => message }))]
16 InvalidFilesPaths {
17 /// An error message that explains which paths are invalid and why.
18 message: String,
19 },
20
21 /// One or more invalid backup entries are encountered.
22 #[error(
23 "{msg}",
24 msg = t!(
25 "error-invalid-backup-entries",
26 { "message" => message }
27 )
28 )]
29 InvalidBackupEntries {
30 /// An error message that explains which backup entries are invalid and why.
31 message: String,
32 },
33
34 /// No schema version can be derived from [alpm-db-files] data.
35 ///
36 /// [alpm-db-files]: https://alpm.archlinux.page/specifications/alpm-db-files.5.html
37 #[error("{msg}", msg = t!("error-schema-version-is-unknown"))]
38 UnknownSchemaVersion,
39}