Skip to content

Commit d19e5f0

Browse files
committed
drop deprecated error handling methods
Now replaced by Event::Error
1 parent 65c0288 commit d19e5f0

File tree

6 files changed

+2
-67
lines changed

6 files changed

+2
-67
lines changed

examples/connection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn main() {
1818

1919
runtime.clone().block_on(async move {
2020
let conn =
21-
Connection::connect_with_runtime(&addr, ConnectionProperties::default(), runtime)
21+
Connection::connect_with_runtime(&addr, ConnectionProperties::default(), runtime.clone())
2222
.await
2323
.expect("connection error");
2424

src/channel.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use crate::{
99
connection_status::{ConnectionResolver, ConnectionStep},
1010
consumer::Consumer,
1111
consumers::Consumers,
12-
error_handler::ErrorHandler,
1312
events::EventsSender,
1413
frames::{ExpectedReply, Frames},
1514
internal_rpc::InternalRPCHandle,
@@ -54,7 +53,6 @@ pub struct Channel {
5453
waker: SocketStateHandle,
5554
internal_rpc: InternalRPCHandle,
5655
frames: Frames,
57-
error_handler: ErrorHandler,
5856
events_sender: EventsSender,
5957
channel_closer: Option<Arc<ChannelCloser>>,
6058
_connection_closer: Option<Arc<ConnectionCloser>>,
@@ -120,7 +118,6 @@ impl Channel {
120118
waker,
121119
internal_rpc,
122120
frames,
123-
error_handler: ErrorHandler::default(),
124121
events_sender,
125122
channel_closer,
126123
_connection_closer: connection_closer,
@@ -132,14 +129,8 @@ impl Channel {
132129
&self.status
133130
}
134131

135-
#[deprecated(note = "Please use Connection::events_listener instead")]
136-
pub fn on_error<E: FnMut(Error) + Send + 'static>(&self, handler: E) {
137-
self.error_handler.set_handler(handler);
138-
}
139-
140132
pub async fn wait_for_recovery(&self, error: Error) -> Result<()> {
141133
if self.recovery_config.can_recover(&error) {
142-
#[allow(deprecated)]
143134
if let Some(notifier) = error.notifier() {
144135
notifier.await;
145136
return Ok(());
@@ -645,7 +636,6 @@ impl Channel {
645636
self.set_closed(err);
646637
if let Some(error) = error {
647638
self.events_sender.error(error.clone());
648-
self.error_handler.on_error(error);
649639
}
650640
}
651641
}

src/channels.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use crate::{
22
BasicProperties, Channel, ChannelState, Configuration, Connection, ConnectionProperties,
33
ConnectionState, ConnectionStatus, Error, ErrorKind, Promise, Result,
44
connection_closer::ConnectionCloser,
5-
error_handler::ErrorHandler,
65
events::{Events, EventsSender},
76
frames::Frames,
87
id_sequence::IdSequence,
@@ -32,7 +31,6 @@ pub(crate) struct Channels {
3231
internal_rpc: InternalRPCHandle,
3332
frames: Frames,
3433
connection_killswitch: KillSwitch,
35-
error_handler: ErrorHandler,
3634
events: Events,
3735
uri: AMQPUri,
3836
options: ConnectionProperties,
@@ -71,7 +69,6 @@ impl Channels {
7169
internal_rpc,
7270
frames,
7371
connection_killswitch: KillSwitch::default(),
74-
error_handler: ErrorHandler::default(),
7572
events,
7673
uri,
7774
options,
@@ -188,7 +185,6 @@ impl Channels {
188185

189186
self.frames.drop_pending(error.clone());
190187
self.events.sender().error(error.clone());
191-
self.error_handler.on_error(error.clone());
192188
for (id, channel) in self.lock_inner().channels.iter() {
193189
self.frames.clear_expected_replies(*id, error.clone());
194190
channel.set_connection_error(error.clone());
@@ -301,10 +297,6 @@ impl Channels {
301297
Ok(())
302298
}
303299

304-
pub(crate) fn set_error_handler<E: FnMut(Error) + Send + 'static>(&self, handler: E) {
305-
self.error_handler.set_handler(handler);
306-
}
307-
308300
pub(crate) fn start_heartbeat(&self) {
309301
let heartbeat = self.configuration.heartbeat();
310302
if heartbeat != 0 {
@@ -388,7 +380,6 @@ impl fmt::Debug for Channels {
388380
debug
389381
.field("frames", &self.frames)
390382
.field("connection_status", &self.connection_status)
391-
.field("error_handler", &self.error_handler)
392383
.finish()
393384
}
394385
}

src/connection.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::{
2-
AsyncTcpStream, ConnectionProperties, ConnectionStatus, Error, ErrorKind, Event, Promise,
3-
Result,
2+
AsyncTcpStream, ConnectionProperties, ConnectionStatus, ErrorKind, Event, Promise, Result,
43
channel::Channel,
54
channels::Channels,
65
configuration::Configuration,
@@ -164,11 +163,6 @@ impl Connection {
164163
io_loop.wait("io loop")
165164
}
166165

167-
#[deprecated(note = "Please use Connection::events_listener instead")]
168-
pub fn on_error<E: FnMut(Error) + Send + 'static>(&self, handler: E) {
169-
self.channels.set_error_handler(handler);
170-
}
171-
172166
pub fn configuration(&self) -> &Configuration {
173167
&self.configuration
174168
}

src/error_handler.rs

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ mod consumer_canceler;
147147
mod consumer_status;
148148
mod consumers;
149149
mod error;
150-
mod error_handler;
151150
mod error_holder;
152151
mod events;
153152
mod exchange;

0 commit comments

Comments
 (0)