OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library pub.exceptions; | 5 library pub.exceptions; |
6 | 6 |
7 import 'dart:async'; | |
8 import 'dart:io'; | 7 import 'dart:io'; |
9 import 'dart:isolate'; | 8 import 'dart:isolate'; |
10 | 9 |
11 import "package:analyzer/analyzer.dart"; | 10 import "package:analyzer/analyzer.dart"; |
12 import "package:http/http.dart" as http; | 11 import "package:http/http.dart" as http; |
13 import "package:stack_trace/stack_trace.dart"; | 12 import "package:stack_trace/stack_trace.dart"; |
14 import "package:yaml/yaml.dart"; | 13 import "package:yaml/yaml.dart"; |
15 | 14 |
16 import '../../asset/dart/serialize.dart'; | 15 import '../../asset/dart/serialize.dart'; |
17 | 16 |
18 /// An exception class for exceptions that are intended to be seen by the user. | 17 /// An exception class for exceptions that are intended to be seen by the user. |
19 /// | 18 /// |
20 /// These exceptions won't have any debugging information printed when they're | 19 /// These exceptions won't have any debugging information printed when they're |
21 /// thrown. | 20 /// thrown. |
22 class ApplicationException implements Exception { | 21 class ApplicationException implements Exception { |
23 final String message; | 22 final String message; |
24 | 23 |
25 ApplicationException(this.message); | 24 ApplicationException(this.message); |
| 25 |
| 26 String toString() => message; |
26 } | 27 } |
27 | 28 |
28 /// A class for exceptions that wrap other exceptions. | 29 /// A class for exceptions that wrap other exceptions. |
29 class WrappedException extends ApplicationException { | 30 class WrappedException extends ApplicationException { |
30 /// The underlying exception that [this] is wrapping, if any. | 31 /// The underlying exception that [this] is wrapping, if any. |
31 final innerError; | 32 final innerError; |
32 | 33 |
33 /// The stack chain for [innerError] if it exists. | 34 /// The stack chain for [innerError] if it exists. |
34 final Chain innerChain; | 35 final Chain innerChain; |
35 | 36 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // TODO(nweiz): unify this list with _userFacingExceptions when issue 5897 is | 97 // TODO(nweiz): unify this list with _userFacingExceptions when issue 5897 is |
97 // fixed. | 98 // fixed. |
98 return error is ApplicationException || | 99 return error is ApplicationException || |
99 error is AnalyzerError || | 100 error is AnalyzerError || |
100 error is AnalyzerErrorGroup || | 101 error is AnalyzerErrorGroup || |
101 error is IsolateSpawnException || | 102 error is IsolateSpawnException || |
102 error is IOException || | 103 error is IOException || |
103 error is http.ClientException || | 104 error is http.ClientException || |
104 error is YamlException; | 105 error is YamlException; |
105 } | 106 } |
OLD | NEW |