File tree Expand file tree Collapse file tree 5 files changed +15
-5
lines changed Expand file tree Collapse file tree 5 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,9 @@ fn main() {
91
91
io :: stdin (). read_line (& mut user_input ). ok ();
92
92
93
93
// 5. Not needed as the async client will cease processing on `drop`.
94
- active_client . deactivate (). unwrap ();
94
+ if let Err (err ) = active_client . deactivate () {
95
+ eprintln! (" JACK exited with error: {err}" );
96
+ }
95
97
}
96
98
```
97
99
Original file line number Diff line number Diff line change @@ -41,7 +41,9 @@ fn main() {
41
41
let mut user_input = String :: new ( ) ;
42
42
io:: stdin ( ) . read_line ( & mut user_input) . ok ( ) ;
43
43
44
- active_client. deactivate ( ) . unwrap ( ) ;
44
+ if let Err ( err) = active_client. deactivate ( ) {
45
+ eprintln ! ( "JACK exited with error: {err}" ) ;
46
+ } ;
45
47
}
46
48
47
49
struct Notifications ;
Original file line number Diff line number Diff line change @@ -105,5 +105,7 @@ fn main() {
105
105
io:: stdin ( ) . read_line ( & mut user_input) . ok ( ) ;
106
106
107
107
// Optional deactivation.
108
- active_client. deactivate ( ) . unwrap ( ) ;
108
+ if let Err ( err) = active_client. deactivate ( ) {
109
+ eprintln ! ( "JACK exited with error: {err}" ) ;
110
+ } ;
109
111
}
Original file line number Diff line number Diff line change @@ -66,7 +66,9 @@ fn main() {
66
66
// 6. Optional deactivate. Not required since active_client will deactivate on
67
67
// drop, though explicit deactivate may help you identify errors in
68
68
// deactivate.
69
- active_client. deactivate ( ) . unwrap ( ) ;
69
+ if let Err ( err) = active_client. deactivate ( ) {
70
+ eprintln ! ( "JACK exited with error: {err}" ) ;
71
+ } ;
70
72
}
71
73
72
74
/// Attempt to read a frequency from standard in. Will block until there is
Original file line number Diff line number Diff line change @@ -28,7 +28,9 @@ use crate::Error;
28
28
/// // An active async client is created, `client` is consumed.
29
29
/// let active_client = client.activate_async((), process_handler).unwrap();
30
30
/// // When done, deactivate the client.
31
- /// active_client.deactivate().unwrap();
31
+ /// if let Err(err) = active_client.deactivate() {
32
+ /// eprintln!("Error deactivating client: {err}");
33
+ /// };
32
34
/// ```
33
35
#[ must_use = "The jack client is shut down when the AsyncClient is dropped. You most likely want to keep this alive and manually tear down with `AsyncClient::deactivate`." ]
34
36
pub struct AsyncClient < N , P > {
You can’t perform that action at this time.
0 commit comments