File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed
Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -130,18 +130,18 @@ impl Agent {
130130 return Err ( Error :: ErrAgentClosed ) ;
131131 }
132132
133- let v = self . transactions . remove ( & id) ;
134- if let Some ( t) = v {
135- if let Some ( handler) = & self . handler {
136- handler. send ( Event {
137- event_type : EventType :: Callback ( t. id ) ,
138- event_body : Err ( error) ,
139- } ) ?;
140- }
141- Ok ( ( ) )
142- } else {
143- Err ( Error :: ErrTransactionNotExists )
133+ let t = self
134+ . transactions
135+ . remove ( & id)
136+ . ok_or ( Error :: ErrTransactionNotExists ) ?;
137+
138+ if let Some ( handler) = & self . handler {
139+ handler. send ( Event {
140+ event_type : EventType :: Callback ( t. id ) ,
141+ event_body : Err ( error) ,
142+ } ) ?;
144143 }
144+ Ok ( ( ) )
145145 }
146146
147147 /// process incoming message, synchronously passing it to handler.
You can’t perform that action at this time.
0 commit comments