@@ -10,6 +10,7 @@ use opentelemetry::trace::{FutureExt, SpanContext, TraceContextExt};
10
10
use parking_lot:: RwLock ;
11
11
use prost:: Message ;
12
12
use std:: collections:: HashMap ;
13
+ use std:: ops:: Deref ;
13
14
use std:: {
14
15
cell:: RefCell ,
15
16
fmt:: Display ,
@@ -90,6 +91,7 @@ enum RuntimeRequest {
90
91
} ,
91
92
}
92
93
94
+ #[ derive( Debug ) ]
93
95
enum WorkerRequest {
94
96
/// A request to shutdown a worker, the worker instance will remain active to
95
97
/// allow draining of pending tasks
@@ -287,7 +289,7 @@ fn start_bridge_loop(channel: Arc<Channel>, receiver: &mut UnboundedReceiver<Run
287
289
Err ( err) => {
288
290
send_error ( channel. clone ( ) , callback, |cx| match err {
289
291
ClientInitError :: SystemInfoCallError ( e) => TRANSPORT_ERROR
290
- . from_error (
292
+ . from_string (
291
293
cx,
292
294
format ! ( "Failed to call GetSystemInfo: {}" , e) ,
293
295
) ,
@@ -364,8 +366,8 @@ fn start_bridge_loop(channel: Arc<Channel>, receiver: &mut UnboundedReceiver<Run
364
366
Ok ( cx. boxed ( RefCell :: new ( Some ( WorkerHandle { sender : tx } ) ) ) )
365
367
} )
366
368
}
367
- Err ( err) => send_error ( channel. clone ( ) , callback, |cx| {
368
- UNEXPECTED_ERROR . from_error ( cx, err)
369
+ Err ( err) => send_error ( channel. clone ( ) , callback, move |cx| {
370
+ UNEXPECTED_ERROR . from_error ( cx, err. deref ( ) )
369
371
} ) ,
370
372
} ;
371
373
}
@@ -826,7 +828,7 @@ fn worker_record_activity_heartbeat(mut cx: FunctionContext) -> JsResult<JsUndef
826
828
let heartbeat = cx. argument :: < JsArrayBuffer > ( 1 ) ?;
827
829
match & * worker. borrow ( ) {
828
830
None => UNEXPECTED_ERROR
829
- . from_error ( & mut cx, "Tried to use closed Worker" )
831
+ . from_string ( & mut cx, "Tried to use closed Worker" )
830
832
. and_then ( |err| cx. throw ( err) ) ?,
831
833
Some ( worker) => {
832
834
match ActivityHeartbeat :: decode_length_delimited ( heartbeat. as_slice ( & mut cx) ) {
@@ -873,7 +875,7 @@ fn worker_finalize_shutdown(mut cx: FunctionContext) -> JsResult<JsUndefined> {
873
875
let worker = cx. argument :: < BoxedWorker > ( 0 ) ?;
874
876
if worker. replace ( None ) . is_none ( ) {
875
877
ILLEGAL_STATE_ERROR
876
- . from_error ( & mut cx, "Worker already closed" )
878
+ . from_string ( & mut cx, "Worker already closed" )
877
879
. and_then ( |err| cx. throw ( err) ) ?;
878
880
}
879
881
@@ -885,7 +887,7 @@ fn client_close(mut cx: FunctionContext) -> JsResult<JsUndefined> {
885
887
let client = cx. argument :: < BoxedClient > ( 0 ) ?;
886
888
if client. replace ( None ) . is_none ( ) {
887
889
ILLEGAL_STATE_ERROR
888
- . from_error ( & mut cx, "Client already closed" )
890
+ . from_string ( & mut cx, "Client already closed" )
889
891
. and_then ( |err| cx. throw ( err) ) ?;
890
892
} ;
891
893
Ok ( cx. undefined ( ) )
0 commit comments