Open Bug 1620583 Opened 1 year ago Updated 10 months ago

[meta] Improve error reporting code


(Core :: JavaScript Engine, task, P3)





(Reporter: evilpie, Unassigned)


(Depends on 9 open bugs)


(Keywords: meta)

Our current error reporting code is very old and quite complicated. Here is a first list of ideas on how to improve this:

  • Remove "extra" warnings
  • Remove "werror"
  • Remove JSREPORT_* flags
  • Separate error and warning reporting
  • Simpler error reporting API like ThrowError(cx, JSMSG_UNDECLARED_VAR, "xyz");
  • Make JSErrorReport type better with ownership and less manual memory management
  • UTF8 vs Latin1
Depends on: 1302358
Depends on: 1611280
Depends on: 1066244
Depends on: 1617657
Priority: -- → P3
Depends on: 1621341

Note that ThrowError ought be split up into ThrowError, ThrowTypeError, ThrowRangeError, and so on, making error numbers either not encode/dictate an error type or asserting at runtime if there's a mismatch. (We already do the latter in self-hosted code for its forms of these functions.)

And all these functions, and the error-reporting internals, need at some point to be adjusted to not use varargs but rather template varargs, that cons the trailing arguments up into a list structure of some sort. (This may or may not be slightly afield of this bug's purpose, unclear.)

I like the idea. DOM code uses functions with the same name and uses a template parameter to statically assert the correct error type.
One annoying thing about SpiderMonkey is that we might need 4 variants: ASCII, Latin1, UTF-8 and Unicode/~UCS-2.

Depends on: 1621635
Depends on: 1621813
Depends on: 1621817
Depends on: 1622562
Depends on: 1623226
Depends on: 1608027
Depends on: 1624577
Depends on: 1506323
Depends on: 1626100
Depends on: 1626122
Depends on: 1144340
Depends on: 1629293
Depends on: 633623
Depends on: 1280258
Depends on: 1639565
You need to log in before you can comment on or make changes to this bug.