Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 28 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gitoxide-core/src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pub async fn connect<Url, E>(
where
Url: TryInto<gix::url::Url, Error = E>,
gix::url::parse::Error: From<E>,
E: std::fmt::Display + std::fmt::Debug + Send + Sync + 'static,
{
Ok(gix::protocol::SendFlushOnDrop::new(
io_mode::connect::connect(url, options).await?,
Expand Down
5 changes: 4 additions & 1 deletion gitoxide-core/src/pack/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ where
.map(|hex_id| {
hex_id
.map_err(|err| Box::new(err) as Box<_>)
.and_then(|hex_id| ObjectId::from_hex(hex_id.as_bytes()).map_err(Into::into))
.and_then(|hex_id| {
ObjectId::from_hex(hex_id.as_bytes())
.map_err(|e| Box::new(e.into_error()) as Box<_>)
})
})
.inspect(move |_| progress.inc()),
),
Expand Down
2 changes: 1 addition & 1 deletion gix-archive/tests/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ mod from_tree {

let head = {
let hex = std::fs::read(dir.join("head.hex"))?;
gix_hash::ObjectId::from_hex(hex.trim())?
gix_hash::ObjectId::from_hex(hex.trim()).map_err(gix_error::Exn::into_error)?
};
let odb = gix_odb::at(dir.join(".git").join("objects"))?;

Expand Down
2 changes: 1 addition & 1 deletion gix-attributes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ bstr = { version = "1.12.0", default-features = false, features = ["std", "unico
smallvec = "1.15.1"
kstring = "2.0.0"
unicode-bom = { version = "2.0.3" }
thiserror = "2.0.18"
gix-error = { version = "^0.0.0", path = "../gix-error" }
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"] }

document-features = { version = "0.2.1", optional = true }
Expand Down
12 changes: 4 additions & 8 deletions gix-attributes/src/name.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use bstr::{BStr, BString, ByteSlice};
use bstr::{BStr, ByteSlice};
use gix_error::OptionExt;
use kstring::KStringRef;

use crate::{Name, NameRef};
Expand Down Expand Up @@ -36,7 +37,7 @@ impl<'a> TryFrom<&'a BStr> for NameRef<'a> {

attr_valid(attr)
.then(|| NameRef(KStringRef::from_ref(attr.to_str().expect("no illformed utf8"))))
.ok_or_else(|| Error { attribute: attr.into() })
.ok_or_raise(|| gix_error::message!("Attribute has non-ascii characters or starts with '-': {attr}"))
}
}

Expand All @@ -59,9 +60,4 @@ impl AsRef<str> for Name {
}

/// The error returned by [`parse::Iter`][crate::parse::Iter].
#[derive(Debug, thiserror::Error)]
#[error("Attribute has non-ascii characters or starts with '-': {attribute}")]
pub struct Error {
/// The attribute that failed to parse.
pub attribute: BString,
}
pub type Error = gix_error::Exn<gix_error::Message>;
Loading
Loading