File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -695,12 +695,9 @@ impl Descriptor<DescriptorPublicKey> {
695695 }
696696
697697 let descriptor = Descriptor :: < String > :: from_str ( s) ?;
698- let descriptor = descriptor. translate_pk ( & mut keymap_pk) . map_err ( |e| {
699- Error :: Unexpected (
700- e. expect_translator_err ( "No Outer context errors" )
701- . to_string ( ) ,
702- )
703- } ) ?;
698+ let descriptor = descriptor
699+ . translate_pk ( & mut keymap_pk)
700+ . map_err ( TranslateErr :: flatten) ?;
704701
705702 Ok ( ( descriptor, keymap_pk. 0 ) )
706703 }
Original file line number Diff line number Diff line change @@ -399,6 +399,17 @@ impl<E> TranslateErr<E> {
399399 }
400400}
401401
402+ impl TranslateErr < Error > {
403+ /// If we are doing a translation where our "outer error" is the generic
404+ /// Miniscript error, eliminate the `TranslateErr` type which is just noise.
405+ pub fn flatten ( self ) -> Error {
406+ match self {
407+ Self :: TranslatorErr ( e) => e,
408+ Self :: OuterError ( e) => e,
409+ }
410+ }
411+ }
412+
402413impl < E > From < E > for TranslateErr < E > {
403414 fn from ( v : E ) -> Self {
404415 Self :: TranslatorErr ( v)
You can’t perform that action at this time.
0 commit comments