Index: sdk/lib/_internal/pub_generated/lib/src/exceptions.dart |
diff --git a/sdk/lib/_internal/pub_generated/lib/src/exceptions.dart b/sdk/lib/_internal/pub_generated/lib/src/exceptions.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f3851a5e948dfa1f14aec16977cb9a5f6c95f040 |
--- /dev/null |
+++ b/sdk/lib/_internal/pub_generated/lib/src/exceptions.dart |
@@ -0,0 +1,74 @@ |
+library pub.exceptions; |
+import 'dart:io'; |
+import 'dart:isolate'; |
+import "package:analyzer/analyzer.dart"; |
+import "package:http/http.dart" as http; |
+import "package:stack_trace/stack_trace.dart"; |
+import "package:yaml/yaml.dart"; |
+import '../../asset/dart/serialize.dart'; |
+class ApplicationException implements Exception { |
+ final String message; |
+ ApplicationException(this.message); |
+ String toString() => message; |
+} |
+class FileException implements ApplicationException { |
+ final String message; |
+ final String path; |
+ FileException(this.message, this.path); |
+ String toString() => message; |
+} |
+class WrappedException extends ApplicationException { |
+ final innerError; |
+ final Chain innerChain; |
+ WrappedException(String message, this.innerError, [StackTrace innerTrace]) |
+ : innerChain = innerTrace == null ? null : new Chain.forTrace(innerTrace), |
+ super(message); |
+} |
+class SilentException extends WrappedException { |
+ SilentException(innerError, [StackTrace innerTrace]) |
+ : super(innerError.toString(), innerError, innerTrace); |
+} |
+class UsageException extends ApplicationException { |
+ String _usage; |
+ UsageException(String message, this._usage) : super(message); |
+ String toString() => "$message\n\n$_usage"; |
+} |
+class DataException extends ApplicationException { |
+ DataException(String message) : super(message); |
+} |
+class PackageNotFoundException extends WrappedException { |
+ PackageNotFoundException(String message, [innerError, StackTrace innerTrace]) |
+ : super(message, innerError, innerTrace); |
+} |
+final _userFacingExceptions = new Set<String>.from( |
+ [ |
+ 'ApplicationException', |
+ 'GitException', |
+ 'ClientException', |
+ 'AnalyzerError', |
+ 'AnalyzerErrorGroup', |
+ 'IsolateSpawnException', |
+ 'CertificateException', |
+ 'FileSystemException', |
+ 'HandshakeException', |
+ 'HttpException', |
+ 'IOException', |
+ 'ProcessException', |
+ 'RedirectException', |
+ 'SignalException', |
+ 'SocketException', |
+ 'StdoutException', |
+ 'TlsException', |
+ 'WebSocketException']); |
+bool isUserFacingException(error) { |
+ if (error is CrossIsolateException) { |
+ return _userFacingExceptions.contains(error.type); |
+ } |
+ return error is ApplicationException || |
+ error is AnalyzerError || |
+ error is AnalyzerErrorGroup || |
+ error is IsolateSpawnException || |
+ error is IOException || |
+ error is http.ClientException || |
+ error is YamlException; |
+} |