Cottonwood-Technology / ValidX

Fast, powerful, and flexible validator with sane syntax.
BSD 2-Clause "Simplified" License
20 stars 4 forks source link

Bug in `format_error` #21

Open GoodWasHere opened 1 year ago

GoodWasHere commented 1 year ago
import validx as v

try:
    v.Str(options=["a"])("b")
except v.exc.ValidationError as e:
    v.exc.format_error(e)
Traceback (most recent call last):
  File "test.py", line 4, in <module>
    v.Str(options=["a"])("b")
  File "src/validx/cy/chars.pyx", line 135, in validx.cy.chars.Str.__call__
validx.exc.errors.OptionsError: <OptionsError(expected=frozenset({'a'}), actual='b')>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 6, in <module>
    v.exc.format_error(e)
  File "validx/exc/formatter.py", line 72, in __call__
    result.append((context, f[1].format(e)))
TypeError: 'frozenset' object is not subscriptable