mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-03-31 17:15:31 +00:00
return Connection on Request error
This commit is contained in:
parent
e878fe4ba2
commit
c5d10e020a
3 changed files with 8 additions and 4 deletions
|
|
@ -80,14 +80,14 @@ impl Client {
|
||||||
server_certificates,
|
server_certificates,
|
||||||
is_session_resumption,
|
is_session_resumption,
|
||||||
) {
|
) {
|
||||||
Ok(connection) => connection.request_async(
|
Ok(connection) => connection.clone().request_async(
|
||||||
request,
|
request,
|
||||||
priority,
|
priority,
|
||||||
cancellable,
|
cancellable,
|
||||||
move |result| {
|
move |result| {
|
||||||
callback(match result {
|
callback(match result {
|
||||||
Ok(response) => Ok(response),
|
Ok(response) => Ok(response),
|
||||||
Err(e) => Err(Error::Request(e)),
|
Err(e) => Err(Error::Request(connection, e)),
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ use glib::{
|
||||||
object::{Cast, ObjectExt},
|
object::{Cast, ObjectExt},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
pub struct Connection {
|
pub struct Connection {
|
||||||
pub network_address: NetworkAddress,
|
pub network_address: NetworkAddress,
|
||||||
pub socket_connection: SocketConnection,
|
pub socket_connection: SocketConnection,
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,10 @@ pub enum Error {
|
||||||
Connect(gio::NetworkAddress, glib::Error),
|
Connect(gio::NetworkAddress, glib::Error),
|
||||||
Connection(gio::SocketConnection, crate::client::connection::Error),
|
Connection(gio::SocketConnection, crate::client::connection::Error),
|
||||||
NetworkAddress(crate::client::connection::request::Error),
|
NetworkAddress(crate::client::connection::request::Error),
|
||||||
Request(crate::client::connection::Error),
|
Request(
|
||||||
|
crate::client::connection::Connection,
|
||||||
|
crate::client::connection::Error,
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for Error {
|
impl Display for Error {
|
||||||
|
|
@ -20,7 +23,7 @@ impl Display for Error {
|
||||||
Self::NetworkAddress(e) => {
|
Self::NetworkAddress(e) => {
|
||||||
write!(f, "Network address error: {e}")
|
write!(f, "Network address error: {e}")
|
||||||
}
|
}
|
||||||
Self::Request(e) => {
|
Self::Request(_, e) => {
|
||||||
write!(f, "Connection error: {e}")
|
write!(f, "Connection error: {e}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue