librosie's trace() function throws the wrong error when given a bad trace type
When match()
is given an invalid output encoding type, it produces an intelligible error, but trace()
does not do the same:
$ python
Python 2.7.10 (default, Oct 6 2017, 22:29:07)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import rosie
>>> e = rosie.engine()
>>> pat, err = e.compile('[0-9]{4}')
>>> e.match(pat, '5523', 1, 'invalid_output_encoder')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/rosie/rosie.py", line 267, in match
raise ValueError("invalid output encoder")
ValueError: invalid output encoder
>>> e.trace(pat, '5523', 1, 'invalid_trace_type')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/rosie/rosie.py", line 281, in trace
raise RuntimeError("trace() failed (please report this as a bug)")
RuntimeError: trace() failed (please report this as a bug)
>>>