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
2 changes: 1 addition & 1 deletion payjoin-ffi/csharp/UnitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public void ReceiverBuilderRejectsBadAddress()
{
var ohttpKeys = OhttpKeys.Decode(OhttpKeysData);

Assert.Throws<ReceiverBuilderException.InvalidAddress>(() =>
Assert.Throws<BuildReceiverException.InvalidAddress>(() =>
{
new ReceiverBuilder("not-an-address", "https://example.com", ohttpKeys);
});
Expand Down
2 changes: 1 addition & 1 deletion payjoin-ffi/python/test/test_payjoin_unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ async def run_test():

class TestValidation(unittest.TestCase):
def test_receiver_builder_rejects_bad_address(self):
with self.assertRaises(cast(type[Exception], payjoin.ReceiverBuilderError)):
with self.assertRaises(cast(type[Exception], payjoin.BuildReceiverError)):
payjoin.ReceiverBuilder(
"not-an-address",
"https://example.com",
Expand Down
10 changes: 5 additions & 5 deletions payjoin-ffi/src/receive/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl_persisted_error_from!(payjoin::IntoUrlError, |api_err: payjoin::IntoUrlErro
/// Error that may occur when building a receiver session.
#[derive(Debug, thiserror::Error, uniffi::Error)]
#[non_exhaustive]
pub enum ReceiverBuilderError {
pub enum BuildReceiverError {
/// The provided Bitcoin address is invalid.
#[error("Invalid Bitcoin address: {0}")]
InvalidAddress(Arc<AddressParseError>),
Expand All @@ -131,15 +131,15 @@ pub enum ReceiverBuilderError {
IntoUrl(Arc<IntoUrlError>),
}

impl From<payjoin::IntoUrlError> for ReceiverBuilderError {
impl From<payjoin::IntoUrlError> for BuildReceiverError {
fn from(value: payjoin::IntoUrlError) -> Self {
ReceiverBuilderError::IntoUrl(Arc::new(value.into()))
BuildReceiverError::IntoUrl(Arc::new(value.into()))
}
}

impl From<payjoin::bitcoin::address::ParseError> for ReceiverBuilderError {
impl From<payjoin::bitcoin::address::ParseError> for BuildReceiverError {
fn from(value: payjoin::bitcoin::address::ParseError) -> Self {
ReceiverBuilderError::InvalidAddress(Arc::new(value.into()))
BuildReceiverError::InvalidAddress(Arc::new(value.into()))
}
}

Expand Down
10 changes: 5 additions & 5 deletions payjoin-ffi/src/receive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use std::str::FromStr;
use std::sync::{Arc, RwLock};

pub use error::{
AddressParseError, CoinSelectionError, InputContributionError, InputPairError, JsonReply,
OutputSubstitutionError, ProtocolError, PsbtInputError, ReceiverBuilderError,
AddressParseError, BuildReceiverError, CoinSelectionError, InputContributionError,
InputPairError, JsonReply, OutputSubstitutionError, ProtocolError, PsbtInputError,
ReceiverCreateRequestError, ReceiverError, SessionError,
};
use payjoin::bitcoin::consensus::Decodable;
Expand Down Expand Up @@ -541,17 +541,17 @@ impl ReceiverBuilder {
address: String,
directory: String,
ohttp_keys: Arc<OhttpKeys>,
) -> Result<Self, ReceiverBuilderError> {
) -> Result<Self, BuildReceiverError> {
let parsed_address = payjoin::bitcoin::Address::from_str(address.as_str())
.map_err(ReceiverBuilderError::from)?
.map_err(BuildReceiverError::from)?
.assume_checked();
Ok(Self(
payjoin::receive::v2::ReceiverBuilder::new(
parsed_address,
directory,
Arc::unwrap_or_clone(ohttp_keys).into(),
)
.map_err(ReceiverBuilderError::from)?,
.map_err(BuildReceiverError::from)?,
))
}

Expand Down
16 changes: 8 additions & 8 deletions payjoin-ffi/src/send/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ use crate::error::{FfiValidationError, ImplementationError};
#[derive(Debug, PartialEq, Eq, thiserror::Error, uniffi::Object)]
#[uniffi::export(Debug, Display, Eq)]
#[error("Error initializing the sender: {msg}")]
pub struct SenderBuilderError {
pub struct BuildSenderError {
msg: String,
}

impl From<PsbtParseError> for SenderBuilderError {
fn from(value: PsbtParseError) -> Self { SenderBuilderError { msg: value.to_string() } }
impl From<PsbtParseError> for BuildSenderError {
fn from(value: PsbtParseError) -> Self { BuildSenderError { msg: value.to_string() } }
}

impl From<send::BuildSenderError> for SenderBuilderError {
fn from(value: send::BuildSenderError) -> Self { SenderBuilderError { msg: value.to_string() } }
impl From<send::BuildSenderError> for BuildSenderError {
fn from(value: send::BuildSenderError) -> Self { BuildSenderError { msg: value.to_string() } }
}

/// FFI-visible PSBT parsing error surfaced at the sender boundary.
Expand All @@ -41,7 +41,7 @@ pub enum SenderInputError {
#[error(transparent)]
Psbt(PsbtParseError),
#[error(transparent)]
Build(Arc<SenderBuilderError>),
Build(Arc<BuildSenderError>),
#[error(transparent)]
FfiValidation(FfiValidationError),
}
Expand Down Expand Up @@ -189,7 +189,7 @@ pub enum SenderError {
Response(ResponseError),
/// Sender Build error
#[error(transparent)]
Build(Arc<SenderBuilderError>),
BuildSender(Arc<BuildSenderError>),
/// Unexpected error
#[error("An unexpected error occurred")]
Unexpected,
Expand Down Expand Up @@ -258,7 +258,7 @@ impl_sender_persisted_error_from!(send::ResponseError, |api_err: send::ResponseE
});

impl_sender_persisted_error_from!(send::BuildSenderError, |api_err: send::BuildSenderError| {
SenderError::Build(Arc::new(api_err.into()))
SenderError::BuildSender(Arc::new(api_err.into()))
});

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion payjoin-ffi/src/send/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::str::FromStr;
use std::sync::{Arc, RwLock};

pub use error::{
CreateRequestError, DecapsulationError, PsbtParseError, ResponseError, SenderBuilderError,
BuildSenderError, CreateRequestError, DecapsulationError, PsbtParseError, ResponseError,
SenderInputError,
};

Expand Down
Loading