@@ -13,6 +13,7 @@ list(StoreOpts, Key) ->
1313 ? event (store_gateway , executing_list ),
1414 case read (StoreOpts , Key ) of
1515 not_found -> not_found ;
16+ failure -> failure ;
1617 {ok , Message } -> {ok , hb_maps :keys (Message , StoreOpts )}
1718 end .
1819
@@ -23,6 +24,7 @@ type(StoreOpts, Key) ->
2324 ? event (store_gateway , executing_type ),
2425 case read (StoreOpts , Key ) of
2526 not_found -> not_found ;
27+ failure -> failure ;
2628 {ok , Data } ->
2729 ? event ({type , hb_private :reset (hb_message :uncommitted (Data , StoreOpts ))}),
2830 IsFlat = lists :all (
@@ -60,14 +62,24 @@ read(BaseStoreOpts, Key) ->
6062 case hb_store_remote_node :read_local_cache (StoreOpts , ID ) of
6163 not_found ->
6264 ? event ({gateway_read , {opts , StoreOpts }, {id , ID }, {subpath , Rest }}),
63- case hb_gateway_client :read (ID , StoreOpts ) of
65+ try hb_gateway_client :read (ID , StoreOpts ) of
6466 {error , _ } ->
6567 ? event ({read_not_found , {key , ID }}),
6668 not_found ;
6769 {ok , Message } ->
6870 ? event ({read_found , {key , ID }}),
6971 hb_store_remote_node :maybe_cache (StoreOpts , Message ),
7072 extract_path_value (Message , Rest , StoreOpts )
73+ catch Class :Reason :Stacktrace ->
74+ ? event (
75+ gateway ,
76+ {read_failed ,
77+ {class , Class },
78+ {reason , Reason },
79+ {stacktrace , {trace , Stacktrace }}
80+ }
81+ ),
82+ failure
7183 end ;
7284 {ok , CachedMessage } ->
7385 extract_path_value (CachedMessage , Rest , StoreOpts )
@@ -463,6 +475,23 @@ verifiability_test() ->
463475 ? event ({verifying , {structured , Structured }, {original , Message }}),
464476 ? assert (hb_message :verify (Structured )).
465477
478+ % % @doc Reading an unsupported signature type transaction should fail
479+ failure_to_process_message_test () ->
480+ hb_http_server :start_node (#{}),
481+ ? assertEqual (failure ,
482+ hb_cache :read (
483+ <<" j0_mJMXG2YO4oRcOtjYsNoUJbN2TaKLo4nTtbhKqnEU" >>,
484+ #{
485+ store =>
486+ [
487+ #{
488+ <<" store-module" >> => hb_store_gateway
489+ }
490+ ]
491+ }
492+ )
493+ ).
494+
466495% % @doc Test that another HyperBEAM node offering the `~query@1.0' device can
467496% % be used as a store.
468497remote_hyperbeam_node_ans104_test () ->
0 commit comments