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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/apiimpl.dart

Issue 20742002: Clean up error handling. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added documentation guide lines. Created 7 years, 5 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
Index: dart/sdk/lib/_internal/compiler/implementation/apiimpl.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/apiimpl.dart b/dart/sdk/lib/_internal/compiler/implementation/apiimpl.dart
index e78ada21ba3831202028d782be75ae61349ea01d..c9ebde7192232bc1a8addf2876697a5fe18a68f2 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/apiimpl.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/apiimpl.dart
@@ -177,7 +177,9 @@ class Compiler extends leg.Compiler {
if (node != null) {
cancel("$exception", node: node);
} else {
- reportDiagnostic(null, "$exception", api.Diagnostic.ERROR);
+ reportError(
+ null,
+ leg.MessageKind.GENERIC, {'text': 'Error: $exception'});
throw new leg.CompilerCancelledException("$exception");
}
}
@@ -219,24 +221,32 @@ class Compiler extends leg.Compiler {
}
if (!allowInternalLibraryAccess) {
if (node != null && importingLibrary != null) {
- reportDiagnostic(spanFromNode(node),
- 'Error: Internal library $resolvedUri is not accessible from '
- '${importingLibrary.canonicalUri}.',
- api.Diagnostic.ERROR);
+ reportError(
+ node,
+ leg.MessageKind.GENERIC,
+ {'text':
+ 'Error: Internal library $resolvedUri is not accessible from '
+ '${importingLibrary.canonicalUri}.'});
} else {
- reportDiagnostic(null,
- 'Error: Internal library $resolvedUri is not accessible.',
- api.Diagnostic.ERROR);
+ reportError(
+ null,
+ leg.MessageKind.GENERIC,
+ {'text':
+ 'Error: Internal library $resolvedUri is not accessible.'});
}
- //path = null;
}
}
if (path == null) {
if (node != null) {
- reportError(node, 'library not found ${resolvedUri}');
+ reportError(
+ node,
+ leg.MessageKind.GENERIC,
+ {'text': 'Error: Library not found ${resolvedUri}.'});
} else {
- reportDiagnostic(null, 'library not found ${resolvedUri}',
- api.Diagnostic.ERROR);
+ reportError(
+ null,
+ leg.MessageKind.GENERIC,
+ {'text': 'Error: Library not found ${resolvedUri}.'});
}
return null;
}
@@ -257,16 +267,8 @@ class Compiler extends leg.Compiler {
Uri translatePackageUri(Uri uri, tree.Node node) {
if (packageRoot == null) {
- if (node != null) {
- reportErrorCode(node,
- leg.MessageKind.PACKAGE_ROOT_NOT_SET,
- {'uri': uri});
- } else {
- reportDiagnostic(null,
- leg.MessageKind.PACKAGE_ROOT_NOT_SET.error({'uri': uri}).toString(),
- api.Diagnostic.ERROR);
- }
- throw new leg.CompilerCancelledException("Package root not set.");
+ reportFatalError(
+ node, leg.MessageKind.PACKAGE_ROOT_NOT_SET, {'uri': uri});
}
return packageRoot.resolve(uri.path);
}

Powered by Google App Engine
This is Rietveld 408576698