summaryrefslogtreecommitdiff
path: root/src/bundle/error.rs
diff options
context:
space:
mode:
authorKim Altintop <kim@eagain.io>2023-01-09 13:18:33 +0100
committerKim Altintop <kim@eagain.io>2023-01-09 13:18:33 +0100
commitd2f423521ec76406944ad83098ec33afe20c692b (patch)
treeafd86bcb088eebdd61ba4e52fa666ff0f41c42a2 /src/bundle/error.rs
This is it
Squashed commit of all the exploration history. Development starts here. Signed-off-by: Kim Altintop <kim@eagain.io>
Diffstat (limited to 'src/bundle/error.rs')
-rw-r--r--src/bundle/error.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/bundle/error.rs b/src/bundle/error.rs
new file mode 100644
index 0000000..41529c2
--- /dev/null
+++ b/src/bundle/error.rs
@@ -0,0 +1,31 @@
+// Copyright © 2022 Kim Altintop <kim@eagain.io>
+// SPDX-License-Identifier: GPL-2.0-only WITH openvpn-openssl-exception
+
+use thiserror::Error;
+
+use super::{
+ ObjectFormat,
+ ObjectId,
+};
+use crate::git::refs;
+
+#[derive(Debug, Error)]
+pub enum Header {
+ #[error("invalid header: {0}")]
+ Format(&'static str),
+
+ #[error("unrecognised header {0}")]
+ UnrecognisedHeader(String),
+
+ #[error("object id {oid} not valid for object-format {fmt}")]
+ ObjectFormat { fmt: ObjectFormat, oid: ObjectId },
+
+ #[error("invalid reference name")]
+ Refname(#[from] refs::error::RefFormat),
+
+ #[error("invalid hex oid")]
+ Oid(#[from] hex::FromHexError),
+
+ #[error(transparent)]
+ Io(#[from] std::io::Error),
+}