Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(930)

Unified Diff: pkg/front_end/lib/src/fasta/errors.dart

Issue 2691613002: Improve compile-time error handling. (Closed)
Patch Set: Update status and expectations for rasta tests. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/front_end/lib/src/fasta/dill/dill_library_builder.dart ('k') | pkg/front_end/lib/src/fasta/import.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/errors.dart
diff --git a/pkg/front_end/lib/src/fasta/errors.dart b/pkg/front_end/lib/src/fasta/errors.dart
index 9e4399dcd84f88a95f5f17dad15a3a416baf5322..077f1609ba19867c24fb8d1581b9735e1b732830 100644
--- a/pkg/front_end/lib/src/fasta/errors.dart
+++ b/pkg/front_end/lib/src/fasta/errors.dart
@@ -34,10 +34,26 @@ bool hasCrashed = false;
/// [resetCrashReporting].
Uri firstSourceUri;
+/// Used to report an internal error.
+///
+/// Internal errors should be avoided as best as possible, but are preferred
+/// over assertion failures. Favor error messages that starts with "Internal
+/// error: " and a short description that may help a developer debug the issue.
+/// This method should be called instead of using `throw`, as this allows us to
+/// ensure that there are no throws anywhere in the codebase.
dynamic internalError(Object error) {
throw error;
}
+/// Used to report an error in input.
+///
+/// Avoid using this for reporting compile-time errors, instead use
+/// `LibraryBuilder.addCompileTimeError` for those.
+///
+/// An input error is any error that isn't an internal error. We use the term
+/// "input error" in favor of "user error". This way, if an input error isn't
+/// handled correctly, the user will never see a stack trace that says "user
+/// error".
dynamic inputError(Uri uri, int charOffset, Object error) {
Siggi Cherem (dart-lang) 2017/02/10 23:12:32 As error-recovery matures is the idea that if we h
ahe 2017/02/13 14:41:02 There are times when this is the correct method to
throw new InputError(uri, charOffset, error);
}
« no previous file with comments | « pkg/front_end/lib/src/fasta/dill/dill_library_builder.dart ('k') | pkg/front_end/lib/src/fasta/import.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698