Skip to content

Commit

Permalink
Merge pull request #786 from mathjax/issue2835
Browse files Browse the repository at this point in the history
Fix problem where errors during mhchem argument collection are not properly handled.  (mathjax/MathJax#2835)
  • Loading branch information
dpvc authored Feb 22, 2022
2 parents 8f381ac + e4528de commit 2051212
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ts/input/tex/mhchem/MhchemConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ MhchemMethods.xArrow = AmsMethods.xArrow;
* @param{string} machine The name of the fininte-state machine to use
*/
MhchemMethods.Machine = function(parser: TexParser, name: string, machine: 'tex' | 'ce' | 'pu') {
let arg = parser.GetArgument(name);
let tex;
try {
let arg = parser.GetArgument(name);
let tex = mhchemParser.toTex(arg, machine);
parser.string = tex + parser.string.substr(parser.i);
parser.i = 0;
tex = mhchemParser.toTex(arg, machine);
} catch (err) {
throw new TexError(err[0], err[1], err.slice(2));
throw new TexError(err[0], err[1]);
}
parser.string = tex + parser.string.substr(parser.i);
parser.i = 0;
};

new CommandMap(
Expand Down

0 comments on commit 2051212

Please sign in to comment.