Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
9e7b6f95
Unverified
Commit
9e7b6f95
authored
Oct 24, 2019
by
Jonah Williams
Committed by
GitHub
Oct 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Catch version and option skew errors from build_daemon (#43403)
parent
1dc0b947
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
0 deletions
+52
-0
resident_web_runner.dart
...utter_tools/lib/src/build_runner/resident_web_runner.dart
+13
-0
resident_web_runner_test.dart
...er_tools/test/general.shard/resident_web_runner_test.dart
+39
-0
No files found.
packages/flutter_tools/lib/src/build_runner/resident_web_runner.dart
View file @
9e7b6f95
...
...
@@ -4,6 +4,7 @@
import
'dart:async'
;
import
'package:build_daemon/client.dart'
;
import
'package:meta/meta.dart'
;
import
'package:vm_service/vm_service.dart'
as
vmservice
;
import
'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'
hide
StackTrace
;
...
...
@@ -212,6 +213,18 @@ class ResidentWebRunner extends ResidentRunner {
);
});
return
result
;
}
on
VersionSkew
{
// Thrown if an older build daemon is already running.
throwToolExit
(
'Another build daemon is already running with an older version.
\n
'
'Try exiting other Flutter processes in this project and try again.'
);
}
on
OptionsSkew
{
// Thrown if a build daemon is already running with different configuration.
throwToolExit
(
'Another build daemon is already running with different configuration.
\n
'
'Try exiting other Flutter processes in this project and try again.'
);
}
on
WebSocketException
{
throwToolExit
(
'Failed to connect to WebSocket.'
);
}
on
BuildException
{
...
...
packages/flutter_tools/test/general.shard/resident_web_runner_test.dart
View file @
9e7b6f95
...
...
@@ -5,6 +5,7 @@
import
'dart:async'
;
import
'dart:convert'
;
import
'package:build_daemon/client.dart'
;
import
'package:dwds/dwds.dart'
;
import
'package:flutter_tools/src/base/common.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
...
...
@@ -583,6 +584,44 @@ void main() {
await
expectation
;
}));
test
(
'Successfully turns OptionsSkew error into ToolExit'
,
()
=>
testbed
.
run
(()
async
{
_setupMocks
();
final
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
=
Completer
<
DebugConnectionInfo
>();
final
Completer
<
void
>
unhandledErrorCompleter
=
Completer
<
void
>();
when
(
mockWebFs
.
connect
(
any
)).
thenAnswer
((
Invocation
_
)
async
{
unawaited
(
unhandledErrorCompleter
.
future
.
then
((
void
value
)
{
throw
OptionsSkew
();
}));
return
ConnectionResult
(
mockAppConnection
,
mockDebugConnection
);
});
final
Future
<
void
>
expectation
=
expectLater
(()
=>
residentWebRunner
.
run
(
connectionInfoCompleter:
connectionInfoCompleter
,
),
throwsA
(
isInstanceOf
<
ToolExit
>()));
unhandledErrorCompleter
.
complete
();
await
expectation
;
}));
test
(
'Successfully turns VersionSkew error into ToolExit'
,
()
=>
testbed
.
run
(()
async
{
_setupMocks
();
final
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
=
Completer
<
DebugConnectionInfo
>();
final
Completer
<
void
>
unhandledErrorCompleter
=
Completer
<
void
>();
when
(
mockWebFs
.
connect
(
any
)).
thenAnswer
((
Invocation
_
)
async
{
unawaited
(
unhandledErrorCompleter
.
future
.
then
((
void
value
)
{
throw
VersionSkew
();
}));
return
ConnectionResult
(
mockAppConnection
,
mockDebugConnection
);
});
final
Future
<
void
>
expectation
=
expectLater
(()
=>
residentWebRunner
.
run
(
connectionInfoCompleter:
connectionInfoCompleter
,
),
throwsA
(
isInstanceOf
<
ToolExit
>()));
unhandledErrorCompleter
.
complete
();
await
expectation
;
}));
test
(
'Rethrows Exception type'
,
()
=>
testbed
.
run
(()
async
{
_setupMocks
();
final
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
=
Completer
<
DebugConnectionInfo
>();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment