File tree 1 file changed +13
-3
lines changed
1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -24,10 +24,18 @@ pub type SentStatus = Box<dyn Error + Send + Sync>;
24
24
pub type StatusSender = futures:: channel:: mpsc:: Sender < SentStatus > ;
25
25
pub type StatusReceiver = futures:: channel:: mpsc:: Receiver < SentStatus > ;
26
26
27
+ fn try_recover_name ( name : & Option < String > ) -> String {
28
+ if let Some ( name) = name {
29
+ name. clone ( )
30
+ } else {
31
+ "unknown" . to_string ( )
32
+ }
33
+ }
34
+
27
35
#[ derive( thiserror:: Error , Debug ) ]
28
36
enum TaskError {
29
- #[ error( "Task halted unexpectedly" ) ]
30
- UnexpectedHalt ,
37
+ #[ error( "Task ('{}') halted unexpectedly" , try_recover_name ( . shutdown_name ) ) ]
38
+ UnexpectedHalt { shutdown_name : Option < String > } ,
31
39
}
32
40
33
41
// TODO: possibly we should create a `Status` trait instead of reusing `Error`
@@ -455,7 +463,9 @@ impl Drop for TaskClient {
455
463
456
464
// If we can't send, well then there is not much to do
457
465
self . drop_error
458
- . send ( Box :: new ( TaskError :: UnexpectedHalt ) )
466
+ . send ( Box :: new ( TaskError :: UnexpectedHalt {
467
+ shutdown_name : self . name . clone ( ) ,
468
+ } ) )
459
469
. ok ( ) ;
460
470
}
461
471
}
You can’t perform that action at this time.
0 commit comments