Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not log eval error for _connectedToProfileBuild check #2954

Merged
merged 1 commit into from
Apr 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/devtools_app/lib/src/connected_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ class ConnectedApp {

// If eval works we're not a profile build.
final io = EvalOnDartLibrary(['dart:io'], serviceManager.service);
final value = await io.eval('Platform.isAndroid', isAlive: null);
// Do not log the error if this eval fails - we expect it to fail for a
// profile build.
final value = await io.eval(
'Platform.isAndroid',
isAlive: null,
shouldLogError: false,
);
return !(value?.kind == 'Bool');

// TODO(terry): Disabled below code, it will hang if flutter run --start-paused
Expand Down
15 changes: 13 additions & 2 deletions packages/devtools_app/lib/src/eval_on_dart_library.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,16 @@ class EvalOnDartLibrary {
String expression, {
@required Disposable isAlive,
Map<String, String> scope,
bool shouldLogError = true,
}) {
return addRequest(isAlive, () => _eval(expression, scope: scope));
return addRequest(
isAlive,
() => _eval(
expression,
scope: scope,
shouldLogError: shouldLogError,
),
);
}

Future<LibraryRef> _waitForLibraryRef() async {
Expand All @@ -136,6 +144,7 @@ class EvalOnDartLibrary {
Future<InstanceRef> _eval(
String expression, {
@required Map<String, String> scope,
bool shouldLogError = true,
}) async {
if (_disposed) return null;

Expand All @@ -157,7 +166,9 @@ class EvalOnDartLibrary {
}
return result;
} catch (e, stack) {
_handleError('$e - $expression', stack);
if (shouldLogError) {
_handleError('$e - $expression', stack);
}
}
return null;
}
Expand Down