File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -771,7 +771,7 @@ impl Descriptor<DescriptorPublicKey> {
771771 let descriptor = Descriptor :: < String > :: from_str ( s) ?;
772772 let descriptor = descriptor
773773 . translate_pk ( & mut keymap_pk)
774- . map_err ( |e| e . expect_translator_err ( "No Outer context errors" ) ) ?;
774+ . map_err ( TranslateErr :: flatten ) ?;
775775
776776 Ok ( ( descriptor, keymap_pk. 0 ) )
777777 }
Original file line number Diff line number Diff line change @@ -364,6 +364,17 @@ impl<E> TranslateErr<E> {
364364 }
365365}
366366
367+ impl TranslateErr < Error > {
368+ /// If we are doing a translation where our "outer error" is the generic
369+ /// Miniscript error, eliminate the `TranslateErr` type which is just noise.
370+ pub fn flatten ( self ) -> Error {
371+ match self {
372+ Self :: TranslatorErr ( e) => e,
373+ Self :: OuterError ( e) => e,
374+ }
375+ }
376+ }
377+
367378impl < E > From < E > for TranslateErr < E > {
368379 fn from ( v : E ) -> Self { Self :: TranslatorErr ( v) }
369380}
You can’t perform that action at this time.
0 commit comments