facebookarchive/prepack

Review all FatalError throws

Open

#2020 aperta il 24 mag 2018

Vedi su GitHub
 (2 commenti) (2 reazioni) (0 assegnatari)JavaScript (520 fork)batch import
bughelp wanted

Metriche repository

Star
 (14.268 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

I've seen a few code snippets like this:

    // todo: emit a diagnostic messsage
    throw new FatalError();

This is problematic for two reasons:

  1. User doesn't get any useful feedback.
  2. Worse, on the command-line it will show up as an internal error, because there must not be a FatalError without a CompilerDiagnostic thingy having been issued.

Concrete work items:

  1. Review all places in the code where a FatalError is thrown, and make sure that a corresponding CompilerDiagnostic thingy was issued before.
  2. Rethink best practices, as it is too easy to create mismatches between FatalError and CompilerDiagnostic (how did this get past code review?).

Guida contributor