From 4b5a37a3362b7c6001f021256c3241e3e592284e Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Tue, 22 Aug 2017 00:06:22 -0400 Subject: [PATCH] [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. --- interfaces/cython/cantera/ck2cti.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interfaces/cython/cantera/ck2cti.py b/interfaces/cython/cantera/ck2cti.py index 504fffe7c..ff822ea35 100644 --- a/interfaces/cython/cantera/ck2cti.py +++ b/interfaces/cython/cantera/ck2cti.py @@ -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 = []