With following parser and string i would expect an exception description which states, that {Re:('a') | Re:('b')} is expected. Instead it only mentions 'Re:('a')':
from pyparsing import *
ab = Regex("prefix") + (Regex("a") | Regex("b"))
s = "prefix c"
ab.parse_string(s)
The exception only lists Re:('a'):
Traceback (most recent call last):
File "test.py", line 9, in <module>
q.parse_string(s)
File "/usr/lib/python3.12/site-packages/pyparsing/core.py", line 1200, in parse_string
raise exc.with_traceback(None)
pyparsing.exceptions.ParseException: Expected Re:('a'), found 'c' (at char 7), (line:1, col:8)
I can directly specify the exception message directly with q.set_fail_action. I havent found any other workaround.