aboutsummaryrefslogtreecommitdiff
path: root/nix-rust/src/error.rs
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-09-18 00:31:51 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-12-10 13:37:23 +0100
commit7f08975050e19b3e3ed002743ed19022789c7ccc (patch)
treeabfbadd19848490618684c892caf21afc182a766 /nix-rust/src/error.rs
parent6317f0f7a0663aed9d877031f7815fa292bd6b09 (diff)
Add NAR parser
Diffstat (limited to 'nix-rust/src/error.rs')
-rw-r--r--nix-rust/src/error.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/nix-rust/src/error.rs b/nix-rust/src/error.rs
index 5717a7a47..4defc646d 100644
--- a/nix-rust/src/error.rs
+++ b/nix-rust/src/error.rs
@@ -8,6 +8,15 @@ pub enum Error {
BadBase32,
StorePathNameTooLong,
BadStorePathName,
+ NarSizeFieldTooBig,
+ BadNarString,
+ BadNarPadding,
+ BadNarVersionMagic,
+ MissingNarOpenTag,
+ MissingNarCloseTag,
+ MissingNarField,
+ BadNarField(String),
+ BadExecutableField,
IOError(std::io::Error),
HttpError(reqwest::Error),
Misc(String),
@@ -37,6 +46,15 @@ impl fmt::Display for Error {
write!(f, "store path name is longer than 211 characters")
}
Error::BadStorePathName => write!(f, "store path name contains forbidden character"),
+ Error::NarSizeFieldTooBig => write!(f, "size field in NAR is too big"),
+ Error::BadNarString => write!(f, "NAR string is not valid UTF-8"),
+ Error::BadNarPadding => write!(f, "NAR padding is not zero"),
+ Error::BadNarVersionMagic => write!(f, "unsupported NAR version"),
+ Error::MissingNarOpenTag => write!(f, "NAR open tag is missing"),
+ Error::MissingNarCloseTag => write!(f, "NAR close tag is missing"),
+ Error::MissingNarField => write!(f, "expected NAR field is missing"),
+ Error::BadNarField(s) => write!(f, "unrecognized NAR field '{}'", s),
+ Error::BadExecutableField => write!(f, "bad 'executable' field in NAR"),
Error::IOError(err) => write!(f, "I/O error: {}", err),
Error::HttpError(err) => write!(f, "HTTP error: {}", err),
Error::Foreign(_) => write!(f, "<C++ exception>"), // FIXME