reportAndRecover abstract method

void reportAndRecover(
  1. BuildError error
)

Reports an error or exception that does not need to suspend compilation.

Unlike throw <Error>, it is expected that the compiler component calling this method is able to gracefully proceed with compilation (by subsituting a default value, by skipping part of the tree, etc), which allows emitting multiple errors instead of just the first one.

An example of where this could be used is in HTML parsing, where you may choose to want to show all invalid HTML instead of one error at a time.

As a result, reportAndRecover is not required to immediately throw (though it can choose to do so, especially in tests were it is unlikely you want compilation to continue on an error). The collected errors are stored and can be lazily reported using throwRecoverableErrors.

Implementation

void reportAndRecover(BuildError error);