@@ -3,6 +3,7 @@ use crate::config::{AllowedFns, Configuration};
3
3
use crate :: test:: data:: new_test_app_info;
4
4
use crate :: test:: router:: TestRouter ;
5
5
use crate :: { MockAdminCall , MockAppCall } ;
6
+ use holochain:: holochain_wasmer_host:: prelude:: WasmErrorInner ;
6
7
use holochain_client:: { ConductorApiError , ExternIO } ;
7
8
use holochain_conductor_api:: ExternalApiWireError ;
8
9
use holochain_types:: prelude:: DnaHash ;
@@ -54,6 +55,32 @@ async fn happy_zome_call() {
54
55
assert_eq ! ( body, r#""return_value""# ) ;
55
56
}
56
57
58
+ #[ tokio:: test]
59
+ async fn ribosome_errors_are_returned ( ) {
60
+ let mut app_call = MockAppCall :: new ( ) ;
61
+ app_call
62
+ . expect_handle_zome_call ( )
63
+ . returning ( |_, _, _, _, _| {
64
+ Box :: pin ( async move {
65
+ // A bit contrived this error, but close enough to reality.
66
+ Err ( crate :: HcHttpGatewayError :: HolochainError (
67
+ ConductorApiError :: ExternalApiWireError ( ExternalApiWireError :: RibosomeError (
68
+ format ! (
69
+ "{:?}" ,
70
+ WasmErrorInner :: Guest ( "could not find record xyz" . to_string( ) )
71
+ ) ,
72
+ ) ) ,
73
+ ) )
74
+ } )
75
+ } ) ;
76
+ let router = create_test_router ( app_call) ;
77
+ let ( status_code, body) = router
78
+ . request ( & format ! ( "/{DNA_HASH}/{APP_ID}/coordinator/fn_name" ) )
79
+ . await ;
80
+ assert_eq ! ( status_code, StatusCode :: INTERNAL_SERVER_ERROR ) ;
81
+ assert_eq ! ( body, r#"{"error":"Guest(\"could not find record xyz\")"}"# ) ;
82
+ }
83
+
57
84
#[ tokio:: test]
58
85
async fn app_not_found ( ) {
59
86
let mut app_call = MockAppCall :: new ( ) ;
@@ -97,7 +124,7 @@ async fn cell_not_found() {
97
124
}
98
125
99
126
#[ tokio:: test]
100
- async fn external_api_wire_error ( ) {
127
+ async fn other_external_api_wire_error ( ) {
101
128
let mut app_call = MockAppCall :: new ( ) ;
102
129
app_call
103
130
. expect_handle_zome_call ( )
0 commit comments