File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -248,22 +248,26 @@ macro_rules! declare_hash_type_with_bech32 {
248248 }
249249
250250 impl TryFrom <Vec <u8 >> for $name {
251- type Error = Vec < u8 > ;
251+ type Error = anyhow :: Error ;
252252 fn try_from( vec: Vec <u8 >) -> Result <Self , Self :: Error > {
253- Ok ( Self ( Hash :: try_from( vec) ?) )
253+ Ok ( Self (
254+ Hash :: try_from( vec) . map_err( |e| anyhow:: anyhow!( "{}" , hex:: encode( e) ) ) ?,
255+ ) )
254256 }
255257 }
256258
257259 impl TryFrom <& [ u8 ] > for $name {
258- type Error = std :: array :: TryFromSliceError ;
260+ type Error = anyhow :: Error ;
259261 fn try_from( arr: & [ u8 ] ) -> Result <Self , Self :: Error > {
260- Ok ( Self ( Hash :: try_from( arr) ?) )
262+ Ok ( Self (
263+ Hash :: try_from( arr) . map_err( |e| anyhow:: anyhow!( "{}" , e) ) ?,
264+ ) )
261265 }
262266 }
263267
264268 impl AsRef <[ u8 ] > for $name {
265269 fn as_ref( & self ) -> & [ u8 ] {
266- self . 0 . as_ref( )
270+ & self . 0 . as_ref( )
267271 }
268272 }
269273
You can’t perform that action at this time.
0 commit comments