mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 14:53:37 +00:00
Create a default error handler to avoid the need for null checks.
R=sigmund@google.com Review-Url: https://codereview.chromium.org/2568583002 .
This commit is contained in:
parent
f43db9ccfa
commit
d70184abd8
|
@ -8,6 +8,9 @@ import 'compilation_error.dart';
|
|||
import 'file_system.dart';
|
||||
import 'physical_file_system.dart';
|
||||
|
||||
/// Default error handler used by [CompielerOptions.onError].
|
||||
void defaultErrorHandler(CompilationError error) => throw error;
|
||||
|
||||
/// Callback used to report errors encountered during compilation.
|
||||
typedef void ErrorHandler(CompilationError error);
|
||||
|
||||
|
@ -25,9 +28,9 @@ class CompilerOptions {
|
|||
|
||||
/// Callback to which compilation errors should be delivered.
|
||||
///
|
||||
/// If `null`, the first error will be reported by throwing an exception of
|
||||
/// By default, the first error will be reported by throwing an exception of
|
||||
/// type [CompilationError].
|
||||
ErrorHandler onError;
|
||||
ErrorHandler onError = defaultErrorHandler;
|
||||
|
||||
/// Path to the ".packages" file.
|
||||
///
|
||||
|
|
Loading…
Reference in a new issue