Skip to content

Commit

Permalink
omitunset parameters when passing them to a dyn chema evaluator. Make…
Browse files Browse the repository at this point in the history
… resulting errors a bit more detailed by including traceback
  • Loading branch information
o-smirnov committed Jul 1, 2024
1 parent ee65aa4 commit bfed2d6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scabha/cargo.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import dataclasses
import re, importlib
import traceback
from collections import OrderedDict
from enum import IntEnum
from dataclasses import dataclass
Expand Down Expand Up @@ -381,10 +382,13 @@ def apply_dynamic_schemas(self, params, subst: Optional[SubstitutionNS]=None):
if self._dyn_schema:
# delete implicit parameters, since they may have come from older version of schema
params = self._delete_implicit_parameters(params, subst)
# get rid of unsets
params = {key: value for key, value in params.items() if value is not UNSET and type(value) is not UNSET}
try:
self.inputs, self.outputs = self._dyn_schema(params, *self._original_inputs_outputs)
except Exception as exc:
raise SchemaError(f"error evaluating dynamic schema", exc) # [exc, sys.exc_info()[2]])
lines = traceback.format_exc().strip().split("\n")
raise SchemaError(f"error evaluating dynamic schema", lines) # [exc, sys.exc_info()[2]])
self._inputs_outputs = None # to regenerate
for io in self.inputs, self.outputs:
for name, schema in list(io.items()):
Expand Down

0 comments on commit bfed2d6

Please sign in to comment.