Page MenuHomePhabricator

Update error handling
Closed, ResolvedPublic

Description

When updating the dependency from texvcjs 0.3.10 to 0.3.11 the texvcinfo tests fail.

{
  column: undefined,
  details: `SyntaxError: Expected "-", "[", "\\\\", "\\\\begin", "\\\\begin{", "]", "^", "_", "{", [ ,\\t,\\n,\\r], [%,$], [(,),.], [,,:,;,?,!,'], [/,|], [0-9], [>,<,~], [\\-,+,*,=], or [a-z,A-Z] but end of input found.`,
  line: undefined,
  offset: undefined,
  status: 'S'
}

should loosely deep-equal

{
  column: undefined,
  details: `SyntaxError: Expected "-", "[", "\\\\", "\\\\begin", "\\\\begin{", "]", "^", "_", "{", [ \\t\\n\\r], [%$], [().], [,:;?!'], [/|], [0-9], [><~], [\\-+*=], or [a-zA-Z] but end of input found.`,
  line: undefined,
  offset: undefined,
  status: 'S'
}
  • understand why the format is different now:

There is a different serialization of the error class. It seems that peggy has a tostring function that is used whereas peg.js did not have this function.
Moreover, the error.message seems to be missing in the new output.
Additionally, the expected regexp contains additional commata. This seems to be factually wrong.
While the comma problem seems harder to solve the first two problems can be militated via

var message = texvcres.error.message;
texvcres.error = JSON.parse(JSON.stringify(texvcres.error));
texvcres.error.message = message;
  • check how Math accesses the error information
  • adjust test cases or fix problem

Related Objects

StatusSubtypeAssignedTask
Resolveddom_walden
ResolvedPhysikerwelt

Event Timeline

I guess the change from peg.js to peggy caused the problem with the different output format since nothing else was changed in between.

I created https://github.com/peggyjs/peggy/issues/244 to see if we need to patch things ourselves or if a new version of peggy can fix it.

Change 793836 had a related patch set uploaded (by Physikerwelt; author: Physikerwelt):

[mediawiki/services/texvcjs@master] Update peggy, and explicit error reading

https://gerrit.wikimedia.org/r/793836

Physikerwelt removed a project: Patch-For-Review.

the change was merged without bug: TXXX in commit message