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

Side by Side Diff: sdk/lib/_internal/pub/lib/src/exceptions.dart

Issue 391363004: Include file path in JSON error when possible. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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:io'; 7 import 'dart:io';
8 import 'dart:isolate'; 8 import 'dart:isolate';
9 9
10 import "package:analyzer/analyzer.dart"; 10 import "package:analyzer/analyzer.dart";
11 import "package:http/http.dart" as http; 11 import "package:http/http.dart" as http;
12 import "package:stack_trace/stack_trace.dart"; 12 import "package:stack_trace/stack_trace.dart";
13 import "package:yaml/yaml.dart"; 13 import "package:yaml/yaml.dart";
14 14
15 import '../../asset/dart/serialize.dart'; 15 import '../../asset/dart/serialize.dart';
16 16
17 /// 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.
18 /// 18 ///
19 /// 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
20 /// thrown. 20 /// thrown.
21 class ApplicationException implements Exception { 21 class ApplicationException implements Exception {
22 final String message; 22 final String message;
23 23
24 ApplicationException(this.message); 24 ApplicationException(this.message);
25 25
26 String toString() => message; 26 String toString() => message;
27 } 27 }
28 28
29 /// An exception class for exceptions that are intended to be seen by the user
30 /// and are associated with a problem in a file at some path.
31 class FileException implements ApplicationException {
32 final String message;
33
34 /// The path to the file that was missing or erroneous.
35 final String path;
36
37 FileException(this.message, this.path);
38
39 String toString() => message;
40 }
41
29 /// A class for exceptions that wrap other exceptions. 42 /// A class for exceptions that wrap other exceptions.
30 class WrappedException extends ApplicationException { 43 class WrappedException extends ApplicationException {
31 /// The underlying exception that [this] is wrapping, if any. 44 /// The underlying exception that [this] is wrapping, if any.
32 final innerError; 45 final innerError;
33 46
34 /// The stack chain for [innerError] if it exists. 47 /// The stack chain for [innerError] if it exists.
35 final Chain innerChain; 48 final Chain innerChain;
36 49
37 WrappedException(String message, this.innerError, [StackTrace innerTrace]) 50 WrappedException(String message, this.innerError, [StackTrace innerTrace])
38 : innerChain = innerTrace == null ? null : new Chain.forTrace(innerTrace), 51 : innerChain = innerTrace == null ? null : new Chain.forTrace(innerTrace),
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // TODO(nweiz): unify this list with _userFacingExceptions when issue 5897 is 119 // TODO(nweiz): unify this list with _userFacingExceptions when issue 5897 is
107 // fixed. 120 // fixed.
108 return error is ApplicationException || 121 return error is ApplicationException ||
109 error is AnalyzerError || 122 error is AnalyzerError ||
110 error is AnalyzerErrorGroup || 123 error is AnalyzerErrorGroup ||
111 error is IsolateSpawnException || 124 error is IsolateSpawnException ||
112 error is IOException || 125 error is IOException ||
113 error is http.ClientException || 126 error is http.ClientException ||
114 error is YamlException; 127 error is YamlException;
115 } 128 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698