[ck2cti] Improve error message when failing to parse a reaction
Show the original reaction expression rather than the one where all recognized tokens have already been replaced.
This commit is contained in:
parent
739d4e4830
commit
4b5a37a336
1 changed files with 2 additions and 1 deletions
|
|
@ -1178,6 +1178,7 @@ class Parser(object):
|
|||
b = float(tokens[-2])
|
||||
Ea = float(tokens[-1])
|
||||
reaction = ''.join(tokens[:-3]) + '\n'
|
||||
original_reaction = reaction # for use in error messages
|
||||
|
||||
# Identify tokens in the reaction expression in order of
|
||||
# decreasing length
|
||||
|
|
@ -1207,7 +1208,7 @@ class Parser(object):
|
|||
try:
|
||||
locs[j] = float(token), 'coeff'
|
||||
except ValueError:
|
||||
raise InputParseError('Unexpected token "{0}" in reaction expression "{1}".'.format(token, reaction))
|
||||
raise InputParseError('Unexpected token "{0}" in reaction expression "{1}".'.format(token, original_reaction))
|
||||
|
||||
reactants = []
|
||||
products = []
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue