@@ -3,6 +3,7 @@ use crate::config::{AllowedFns, Configuration};
33use crate :: test:: data:: new_test_app_info;
44use crate :: test:: router:: TestRouter ;
55use crate :: { MockAdminCall , MockAppCall } ;
6+ use holochain:: holochain_wasmer_host:: prelude:: WasmErrorInner ;
67use holochain_client:: { ConductorApiError , ExternIO } ;
78use holochain_conductor_api:: ExternalApiWireError ;
89use holochain_types:: prelude:: DnaHash ;
@@ -54,6 +55,32 @@ async fn happy_zome_call() {
5455 assert_eq ! ( body, r#""return_value""# ) ;
5556}
5657
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+
5784#[ tokio:: test]
5885async fn app_not_found ( ) {
5986 let mut app_call = MockAppCall :: new ( ) ;
@@ -97,7 +124,7 @@ async fn cell_not_found() {
97124}
98125
99126#[ tokio:: test]
100- async fn external_api_wire_error ( ) {
127+ async fn other_external_api_wire_error ( ) {
101128 let mut app_call = MockAppCall :: new ( ) ;
102129 app_call
103130 . expect_handle_zome_call ( )
0 commit comments