@@ -337,7 +337,7 @@ impl SigningKeyCache {
337337/// Non-transient errors (not found, serialization, internal) indicate a
338338/// definitive response from Ledger and should not use fallback.
339339fn is_transient_error ( error : & StorageError ) -> bool {
340- matches ! ( error, StorageError :: Connection ( _ ) | StorageError :: Timeout )
340+ matches ! ( error, StorageError :: Connection { .. } | StorageError :: Timeout { .. } )
341341}
342342
343343/// Validates that a key is in a usable state.
@@ -742,11 +742,11 @@ mod tests {
742742 ) -> Result < Option < PublicSigningKey > , StorageError > {
743743 if let Some ( ref error) = * self . fail_with . lock ( ) . expect ( "lock" ) {
744744 return Err ( match error {
745- StorageError :: Connection ( msg ) => StorageError :: Connection ( msg . clone ( ) ) ,
746- StorageError :: Timeout => StorageError :: Timeout ,
747- StorageError :: NotFound ( msg ) => StorageError :: NotFound ( msg . clone ( ) ) ,
748- StorageError :: Internal ( msg ) => StorageError :: Internal ( msg . clone ( ) ) ,
749- _ => StorageError :: Internal ( "unknown" . to_string ( ) ) ,
745+ StorageError :: Connection { message , .. } => StorageError :: connection ( message ) ,
746+ StorageError :: Timeout { .. } => StorageError :: timeout ( ) ,
747+ StorageError :: NotFound { key , .. } => StorageError :: not_found ( key ) ,
748+ StorageError :: Internal { message , .. } => StorageError :: internal ( message ) ,
749+ _ => StorageError :: internal ( "unknown" ) ,
750750 } ) ;
751751 }
752752 self . inner . get_key ( namespace_id, kid) . await
@@ -797,7 +797,7 @@ mod tests {
797797 assert ! ( result1. is_ok( ) ) ;
798798
799799 // Simulate Ledger connection failure
800- store. set_failure ( Some ( StorageError :: Connection ( "network error" . to_string ( ) ) ) ) ;
800+ store. set_failure ( Some ( StorageError :: connection ( "network error" ) ) ) ;
801801
802802 // Clear TTL cache to force Ledger lookup
803803 cache. clear_all ( ) . await ;
@@ -824,7 +824,7 @@ mod tests {
824824 assert ! ( result1. is_ok( ) ) ;
825825
826826 // Simulate Ledger timeout
827- store. set_failure ( Some ( StorageError :: Timeout ) ) ;
827+ store. set_failure ( Some ( StorageError :: timeout ( ) ) ) ;
828828
829829 // Clear TTL cache
830830 cache. clear_all ( ) . await ;
@@ -851,7 +851,7 @@ mod tests {
851851 assert ! ( result1. is_ok( ) ) ;
852852
853853 // Simulate non-transient internal error (should NOT use fallback)
854- store. set_failure ( Some ( StorageError :: Internal ( "db corruption" . to_string ( ) ) ) ) ;
854+ store. set_failure ( Some ( StorageError :: internal ( "db corruption" ) ) ) ;
855855
856856 // Clear TTL cache
857857 cache. clear_all ( ) . await ;
@@ -876,7 +876,7 @@ mod tests {
876876 ) ;
877877
878878 // Simulate connection failure with no prior cache
879- store. set_failure ( Some ( StorageError :: Connection ( "network error" . to_string ( ) ) ) ) ;
879+ store. set_failure ( Some ( StorageError :: connection ( "network error" ) ) ) ;
880880
881881 // Should return error since no fallback available
882882 let result = cache. get_decoding_key ( 1 , "unknown-key" ) . await ;
@@ -888,25 +888,25 @@ mod tests {
888888
889889 #[ test]
890890 fn test_is_transient_error_connection ( ) {
891- let error = StorageError :: Connection ( "network error" . to_string ( ) ) ;
891+ let error = StorageError :: connection ( "network error" ) ;
892892 assert ! ( is_transient_error( & error) ) ;
893893 }
894894
895895 #[ test]
896896 fn test_is_transient_error_timeout ( ) {
897- let error = StorageError :: Timeout ;
897+ let error = StorageError :: timeout ( ) ;
898898 assert ! ( is_transient_error( & error) ) ;
899899 }
900900
901901 #[ test]
902902 fn test_is_transient_error_not_found ( ) {
903- let error = StorageError :: NotFound ( "key" . to_string ( ) ) ;
903+ let error = StorageError :: not_found ( "key" ) ;
904904 assert ! ( !is_transient_error( & error) ) ;
905905 }
906906
907907 #[ test]
908908 fn test_is_transient_error_internal ( ) {
909- let error = StorageError :: Internal ( "oops" . to_string ( ) ) ;
909+ let error = StorageError :: internal ( "oops" ) ;
910910 assert ! ( !is_transient_error( & error) ) ;
911911 }
912912
@@ -1062,7 +1062,7 @@ mod tests {
10621062 #[ tokio:: test]
10631063 async fn test_metrics_storage_error ( ) {
10641064 let store = Arc :: new ( FailingStore :: new ( ) ) ;
1065- store. set_failure ( Some ( StorageError :: Internal ( "db error" . to_string ( ) ) ) ) ;
1065+ store. set_failure ( Some ( StorageError :: internal ( "db error" ) ) ) ;
10661066
10671067 let metrics = create_test_metrics ( ) ;
10681068 let cache = SigningKeyCache :: new (
0 commit comments