facebookarchive/prepack

Review all FatalError throws

Open

#2020 opened on May 24, 2018

View on GitHub
 (2 comments) (2 reactions) (0 assignees)JavaScript (14,268 stars) (520 forks)batch import
bughelp wanted

Description

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?).

Contributor guide