-
Notifications
You must be signed in to change notification settings - Fork 332
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
some work on how we print exceptions (#929)
* some work on how we print exceptions * use config specific imports * review comments
- Loading branch information
1 parent
2b0da23
commit 2fe32ff
Showing
7 changed files
with
142 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright 2019 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
export 'allowed_error_default.dart' | ||
if (dart.library.html) 'allowed_error_html.dart'; |
15 changes: 15 additions & 0 deletions
15
packages/devtools/lib/src/config_specific/allowed_error_default.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2019 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
/// Catch and print errors from the given future. These errors are part of | ||
/// normal operation for an app, and don't need to be reported to analytics | ||
/// (i.e., they're not DevTools crashes). | ||
Future<T> allowedError<T>(Future<T> future) { | ||
return future.catchError((Object error) { | ||
final errorLines = error.toString().split('\n'); | ||
print('[${error.runtimeType}] ${errorLines.first}'); | ||
print(errorLines.skip(1).join('\n')); | ||
print(''); | ||
}); | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/devtools/lib/src/config_specific/allowed_error_html.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2019 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'dart:html'; | ||
|
||
/// Catch and print errors from the given future. These errors are part of | ||
/// normal operation for an app, and don't need to be reported to analytics | ||
/// (i.e., they're not DevTools crashes). | ||
Future<T> allowedError<T>(Future<T> future) { | ||
return future.catchError((Object error) { | ||
final errorLines = error.toString().split('\n'); | ||
window.console.groupCollapsed('[${error.runtimeType}] ${errorLines.first}'); | ||
window.console.log(errorLines.skip(1).join('\n')); | ||
window.console.groupEnd(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters