2929from .base import (
3030 UNSET ,
3131 Items ,
32- MultiValueError ,
3332 Operation ,
3433 Plottable ,
3534 PlotArgs ,
@@ -587,20 +586,12 @@ def validate_fn_name(self):
587586 )
588587
589588 def _prepare_match_inputs_error (
590- self ,
591- exceptions : List [Tuple [Any , Exception ]],
592- missing : List ,
593- varargs_bad : List ,
594- named_inputs : Mapping ,
589+ self , missing : List , varargs_bad : List , named_inputs : Mapping ,
595590 ) -> ValueError :
596591 from .config import is_debug
597592
598- errors = [
599- f"{ i } . Need({ n !r} ) failed due to: { type (nex ).__name__ } ({ nex } )"
600- for i , (n , nex ) in enumerate (exceptions , 1 )
601- ]
602- ner = len (exceptions ) + 1
603-
593+ ner = 1
594+ errors = []
604595 if missing :
605596 errors .append (f"{ ner } . Missing compulsory needs{ list (missing )} !" )
606597 ner += 1
@@ -611,20 +602,18 @@ def _prepare_match_inputs_error(
611602 inputs = dict (named_inputs ) if is_debug () else list (named_inputs )
612603 errors .append (f"+++inputs: { inputs } " )
613604 errors .append (f"+++{ self } " )
614- errors .append (
615- "(tip: set GRAPHTIK_DEBUG envvar to raise immediately and/or enable DEBUG-logging)"
616- )
617605
618606 msg = textwrap .indent ("\n " .join (errors ), " " * 4 )
619- raise MultiValueError (f"Failed preparing needs: \n { msg } " , * exceptions )
607+ raise ValueError (f"Failed preparing needs: \n { msg } " )
620608
621609 def _match_inputs_with_fn_needs (self , named_inputs ) -> Tuple [list , list , dict ]:
622610 positional , vararg_vals = [], []
623611 kwargs = {}
624- errors , missing , varargs_bad = [], [], []
612+ missing , varargs_bad = [], []
625613 for n in self ._fn_needs :
626- assert not is_sfx (n ), locals ()
627614 try :
615+ ok = False
616+ assert not is_sfx (n ), locals ()
628617 if n not in named_inputs :
629618 if not is_optional (n ) or is_sfx (n ):
630619 # It means `inputs` < compulsory `needs`.
@@ -653,25 +642,15 @@ def _match_inputs_with_fn_needs(self, named_inputs) -> Tuple[list, list, dict]:
653642
654643 else :
655644 positional .append (inp_value )
645+ ok = True
646+ finally :
647+ if not ok :
648+ log .error (
649+ "Failed while preparing op(%s) need(%s)!" , self .name , n ,
650+ )
656651
657- except Exception as nex :
658- from .config import is_debug
659-
660- if is_debug ():
661- raise
662- log .debug (
663- "Cannot prepare op(%s) need(%s) due to: %s" ,
664- self .name ,
665- n ,
666- nex ,
667- exc_info = nex ,
668- )
669- errors .append ((n , nex ))
670-
671- if errors or missing or varargs_bad :
672- raise self ._prepare_match_inputs_error (
673- errors , missing , varargs_bad , named_inputs
674- )
652+ if missing or varargs_bad :
653+ raise self ._prepare_match_inputs_error (missing , varargs_bad , named_inputs )
675654
676655 return positional , vararg_vals , kwargs
677656
0 commit comments