File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -96,14 +96,14 @@ impl TryFrom<HashMap<String, AttributeValue>> for Sealed {
9696 . get ( "pk" )
9797 . ok_or ( ReadConversionError :: NoSuchAttribute ( "pk" . to_string ( ) ) ) ?
9898 . as_s ( )
99- . unwrap ( )
99+ . map_err ( |_| ReadConversionError :: InvalidFormat ( "pk" . to_string ( ) ) ) ?
100100 . to_string ( ) ;
101101
102102 let sk = item
103103 . get ( "sk" )
104104 . ok_or ( ReadConversionError :: NoSuchAttribute ( "sk" . to_string ( ) ) ) ?
105105 . as_s ( )
106- . unwrap ( )
106+ . map_err ( |_| ReadConversionError :: InvalidFormat ( "sk" . to_string ( ) ) ) ?
107107 . to_string ( ) ;
108108
109109 let mut table_entry = TableEntry :: new ( pk, sk) ;
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ use thiserror::Error;
1717pub enum ReadConversionError {
1818 #[ error( "Missing attribute: {0}" ) ]
1919 NoSuchAttribute ( String ) ,
20+ #[ error( "Invalid format: {0}" ) ]
21+ InvalidFormat ( String ) ,
2022 #[ error( "Failed to convert attribute: {0} from Plaintext" ) ]
2123 ConversionFailed ( String ) ,
2224}
You can’t perform that action at this time.
0 commit comments