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

Side by Side Diff: lib/src/error_listener.dart

Issue 2837143003: Don't dump a stack trace on the user if the formatter had bad output. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « lib/src/dart_formatter.dart ('k') | lib/src/exceptions.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 dart_style.src.error_listener; 5 library dart_style.src.error_listener;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 8
9 import 'formatter_exception.dart'; 9 import 'exceptions.dart';
10 10
11 /// A simple [AnalysisErrorListener] that just collects the reported errors. 11 /// A simple [AnalysisErrorListener] that just collects the reported errors.
12 class ErrorListener implements AnalysisErrorListener { 12 class ErrorListener implements AnalysisErrorListener {
13 final _errors = <AnalysisError>[]; 13 final _errors = <AnalysisError>[];
14 14
15 void onError(AnalysisError error) { 15 void onError(AnalysisError error) {
16 _errors.add(error); 16 _errors.add(error);
17 } 17 }
18 18
19 /// Throws a [FormatterException] if any errors have been reported. 19 /// Throws a [FormatterException] if any errors have been reported.
20 void throwIfErrors() { 20 void throwIfErrors() {
21 if (_errors.isEmpty) return; 21 if (_errors.isEmpty) return;
22 22
23 throw new FormatterException(_errors); 23 throw new FormatterException(_errors);
24 } 24 }
25 } 25 }
OLDNEW
« no previous file with comments | « lib/src/dart_formatter.dart ('k') | lib/src/exceptions.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698