@@ -18,7 +18,7 @@ pub use self::runtime::ServiceRuntime;
18
18
pub use self :: test_runtime:: MockServiceRuntime ;
19
19
#[ doc( hidden) ]
20
20
pub use self :: wit:: export_service;
21
- use crate :: { util:: BlockingWait , ServiceLogger } ;
21
+ use crate :: util:: BlockingWait as _ ;
22
22
23
23
/// Inside tests, use the [`MockServiceRuntime`] instead of the real [`ServiceRuntime`].
24
24
#[ cfg( with_testing) ]
@@ -41,9 +41,10 @@ macro_rules! service {
41
41
/// Mark the service type to be exported.
42
42
impl $crate:: service:: wit:: exports:: linera:: app:: service_entrypoints:: Guest for $service {
43
43
fn handle_query( argument: Vec <u8 >) -> Vec <u8 > {
44
- use $crate:: util:: BlockingWait ;
44
+ use $crate:: util:: BlockingWait as _;
45
+ $crate:: ServiceLogger :: install( ) ;
45
46
let request = $crate:: serde_json:: from_slice( & argument)
46
- . expect ( "Query is invalid and could not be deserialized" ) ;
47
+ . unwrap_or_else ( |_| panic! ( "Query {argument:?} is invalid and could not be deserialized" ) ) ;
47
48
let response = $crate:: service:: run_async_entrypoint(
48
49
unsafe { & mut SERVICE } ,
49
50
move |service| service. handle_query( request) . blocking_wait( ) ,
@@ -69,8 +70,6 @@ pub fn run_async_entrypoint<Service, Output>(
69
70
where
70
71
Service : crate :: Service ,
71
72
{
72
- ServiceLogger :: install ( ) ;
73
-
74
73
let service =
75
74
service. get_or_insert_with ( || Service :: new ( ServiceRuntime :: new ( ) ) . blocking_wait ( ) ) ;
76
75
0 commit comments