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
d7688ca0
Unverified
Commit
d7688ca0
authored
Feb 02, 2022
by
Lau Ching Jun
Committed by
GitHub
Feb 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change all instance of throwing strings to throw specific error classes. (#97325)
parent
97124d7b
Changes
32
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
145 additions
and
119 deletions
+145
-119
analysis_options.yaml
packages/flutter_tools/analysis_options.yaml
+1
-1
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+33
-23
update_packages.dart
packages/flutter_tools/lib/src/commands/update_packages.dart
+8
-18
fuchsia_device.dart
packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
+3
-3
localizations_utils.dart
...tter_tools/lib/src/localizations/localizations_utils.dart
+1
-1
devices.dart
packages/flutter_tools/lib/src/proxied_devices/devices.dart
+1
-1
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+2
-2
run_cold.dart
packages/flutter_tools/lib/src/run_cold.dart
+2
-2
run_hot.dart
packages/flutter_tools/lib/src/run_hot.dart
+1
-1
flutter_platform.dart
packages/flutter_tools/lib/src/test/flutter_platform.dart
+2
-2
daemon_test.dart
...utter_tools/test/commands.shard/hermetic/daemon_test.dart
+1
-1
doctor_test.dart
...utter_tools/test/commands.shard/hermetic/doctor_test.dart
+4
-4
android_device_test.dart
...tools/test/general.shard/android/android_device_test.dart
+3
-3
async_guard_test.dart
...utter_tools/test/general.shard/base/async_guard_test.dart
+26
-15
error_handling_io_test.dart
...tools/test/general.shard/base/error_handling_io_test.dart
+1
-1
logger_test.dart
...es/flutter_tools/test/general.shard/base/logger_test.dart
+3
-3
crash_reporting_test.dart
...lutter_tools/test/general.shard/crash_reporting_test.dart
+1
-1
devfs_test.dart
packages/flutter_tools/test/general.shard/devfs_test.dart
+1
-1
fuchsia_device_test.dart
...tools/test/general.shard/fuchsia/fuchsia_device_test.dart
+15
-3
hot_test.dart
packages/flutter_tools/test/general.shard/hot_test.dart
+4
-4
project_test.dart
packages/flutter_tools/test/general.shard/project_test.dart
+1
-1
protocol_discovery_test.dart
...ter_tools/test/general.shard/protocol_discovery_test.dart
+2
-2
resident_runner_test.dart
...lutter_tools/test/general.shard/resident_runner_test.dart
+2
-2
resident_web_runner_test.dart
...er_tools/test/general.shard/resident_web_runner_test.dart
+3
-1
runner_test.dart
.../flutter_tools/test/general.shard/runner/runner_test.dart
+10
-10
test_client.dart
...ols/test/integration.shard/debug_adapter/test_client.dart
+3
-3
test_server.dart
...ols/test/integration.shard/debug_adapter/test_server.dart
+2
-2
hot_reload_errors_test.dart
..._tools/test/integration.shard/hot_reload_errors_test.dart
+1
-1
test_driver.dart
...ges/flutter_tools/test/integration.shard/test_driver.dart
+2
-2
context.dart
packages/flutter_tools/test/src/context.dart
+3
-3
fake_process_manager.dart
packages/flutter_tools/test/src/fake_process_manager.dart
+2
-1
test_build_system.dart
packages/flutter_tools/test/src/test_build_system.dart
+1
-1
No files found.
packages/flutter_tools/analysis_options.yaml
View file @
d7688ca0
...
@@ -7,7 +7,7 @@ linter:
...
@@ -7,7 +7,7 @@ linter:
curly_braces_in_flow_control_structures
:
true
curly_braces_in_flow_control_structures
:
true
library_private_types_in_public_api
:
false
# Tool does not have any public API.
library_private_types_in_public_api
:
false
# Tool does not have any public API.
no_runtimeType_toString
:
false
# We use runtimeType for debugging in the tool.
no_runtimeType_toString
:
false
# We use runtimeType for debugging in the tool.
only_throw_errors
:
false
# For historical reasons we throw strings a lot.
only_throw_errors
:
true
prefer_relative_imports
:
true
prefer_relative_imports
:
true
public_member_api_docs
:
false
# Tool does not have any public API.
public_member_api_docs
:
false
# Tool does not have any public API.
unawaited_futures
:
true
unawaited_futures
:
true
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
d7688ca0
...
@@ -212,13 +212,13 @@ class Daemon {
...
@@ -212,13 +212,13 @@ class Daemon {
final
String
method
=
request
.
data
[
'method'
]
as
String
;
final
String
method
=
request
.
data
[
'method'
]
as
String
;
assert
(
method
!=
null
);
assert
(
method
!=
null
);
if
(!
method
.
contains
(
'.'
))
{
if
(!
method
.
contains
(
'.'
))
{
throw
'method not understood:
$method
'
;
throw
DaemonException
(
'method not understood:
$method
'
)
;
}
}
final
String
prefix
=
method
.
substring
(
0
,
method
.
indexOf
(
'.'
));
final
String
prefix
=
method
.
substring
(
0
,
method
.
indexOf
(
'.'
));
final
String
name
=
method
.
substring
(
method
.
indexOf
(
'.'
)
+
1
);
final
String
name
=
method
.
substring
(
method
.
indexOf
(
'.'
)
+
1
);
if
(
_domainMap
[
prefix
]
==
null
)
{
if
(
_domainMap
[
prefix
]
==
null
)
{
throw
'no domain for method:
$method
'
;
throw
DaemonException
(
'no domain for method:
$method
'
)
;
}
}
_domainMap
[
prefix
].
handleCommand
(
name
,
id
,
castStringKeyedMap
(
request
.
data
[
'params'
])
??
const
<
String
,
dynamic
>{},
request
.
binary
);
_domainMap
[
prefix
].
handleCommand
(
name
,
id
,
castStringKeyedMap
(
request
.
data
[
'params'
])
??
const
<
String
,
dynamic
>{},
request
.
binary
);
...
@@ -275,7 +275,7 @@ abstract class Domain {
...
@@ -275,7 +275,7 @@ abstract class Domain {
}
else
if
(
_handlersWithBinary
.
containsKey
(
command
))
{
}
else
if
(
_handlersWithBinary
.
containsKey
(
command
))
{
return
_handlersWithBinary
[
command
](
args
,
binary
);
return
_handlersWithBinary
[
command
](
args
,
binary
);
}
}
throw
'command not understood:
$name
.
$command
'
;
throw
DaemonException
(
'command not understood:
$name
.
$command
'
)
;
}).
then
<
dynamic
>((
dynamic
result
)
{
}).
then
<
dynamic
>((
dynamic
result
)
{
daemon
.
connection
.
sendResponse
(
id
,
_toJsonable
(
result
));
daemon
.
connection
.
sendResponse
(
id
,
_toJsonable
(
result
));
}).
catchError
((
Object
error
,
StackTrace
stackTrace
)
{
}).
catchError
((
Object
error
,
StackTrace
stackTrace
)
{
...
@@ -289,33 +289,33 @@ abstract class Domain {
...
@@ -289,33 +289,33 @@ abstract class Domain {
String
_getStringArg
(
Map
<
String
,
dynamic
>
args
,
String
name
,
{
bool
required
=
false
})
{
String
_getStringArg
(
Map
<
String
,
dynamic
>
args
,
String
name
,
{
bool
required
=
false
})
{
if
(
required
&&
!
args
.
containsKey
(
name
))
{
if
(
required
&&
!
args
.
containsKey
(
name
))
{
throw
'
$name
is required'
;
throw
DaemonException
(
'
$name
is required'
)
;
}
}
final
dynamic
val
=
args
[
name
];
final
dynamic
val
=
args
[
name
];
if
(
val
!=
null
&&
val
is
!
String
)
{
if
(
val
!=
null
&&
val
is
!
String
)
{
throw
'
$name
is not a String'
;
throw
DaemonException
(
'
$name
is not a String'
)
;
}
}
return
val
as
String
;
return
val
as
String
;
}
}
bool
_getBoolArg
(
Map
<
String
,
dynamic
>
args
,
String
name
,
{
bool
required
=
false
})
{
bool
_getBoolArg
(
Map
<
String
,
dynamic
>
args
,
String
name
,
{
bool
required
=
false
})
{
if
(
required
&&
!
args
.
containsKey
(
name
))
{
if
(
required
&&
!
args
.
containsKey
(
name
))
{
throw
'
$name
is required'
;
throw
DaemonException
(
'
$name
is required'
)
;
}
}
final
dynamic
val
=
args
[
name
];
final
dynamic
val
=
args
[
name
];
if
(
val
!=
null
&&
val
is
!
bool
)
{
if
(
val
!=
null
&&
val
is
!
bool
)
{
throw
'
$name
is not a bool'
;
throw
DaemonException
(
'
$name
is not a bool'
)
;
}
}
return
val
as
bool
;
return
val
as
bool
;
}
}
int
_getIntArg
(
Map
<
String
,
dynamic
>
args
,
String
name
,
{
bool
required
=
false
})
{
int
_getIntArg
(
Map
<
String
,
dynamic
>
args
,
String
name
,
{
bool
required
=
false
})
{
if
(
required
&&
!
args
.
containsKey
(
name
))
{
if
(
required
&&
!
args
.
containsKey
(
name
))
{
throw
'
$name
is required'
;
throw
DaemonException
(
'
$name
is required'
)
;
}
}
final
dynamic
val
=
args
[
name
];
final
dynamic
val
=
args
[
name
];
if
(
val
!=
null
&&
val
is
!
int
)
{
if
(
val
!=
null
&&
val
is
!
int
)
{
throw
'
$name
is not an int'
;
throw
DaemonException
(
'
$name
is not an int'
)
;
}
}
return
val
as
int
;
return
val
as
int
;
}
}
...
@@ -670,7 +670,7 @@ class AppDomain extends Domain {
...
@@ -670,7 +670,7 @@ class AppDomain extends Domain {
final
AppInstance
app
=
_getApp
(
appId
);
final
AppInstance
app
=
_getApp
(
appId
);
if
(
app
==
null
)
{
if
(
app
==
null
)
{
throw
"app '
$appId
' not found"
;
throw
DaemonException
(
"app '
$appId
' not found"
)
;
}
}
return
_queueAndDebounceReloadAction
(
return
_queueAndDebounceReloadAction
(
...
@@ -728,7 +728,7 @@ class AppDomain extends Domain {
...
@@ -728,7 +728,7 @@ class AppDomain extends Domain {
final
AppInstance
app
=
_getApp
(
appId
);
final
AppInstance
app
=
_getApp
(
appId
);
if
(
app
==
null
)
{
if
(
app
==
null
)
{
throw
"app '
$appId
' not found"
;
throw
DaemonException
(
"app '
$appId
' not found"
)
;
}
}
final
FlutterDevice
device
=
app
.
runner
.
flutterDevices
.
first
;
final
FlutterDevice
device
=
app
.
runner
.
flutterDevices
.
first
;
final
List
<
FlutterView
>
views
=
await
device
.
vmService
.
getFlutterViews
();
final
List
<
FlutterView
>
views
=
await
device
.
vmService
.
getFlutterViews
();
...
@@ -741,7 +741,7 @@ class AppDomain extends Domain {
...
@@ -741,7 +741,7 @@ class AppDomain extends Domain {
.
first
.
uiIsolate
.
id
.
first
.
uiIsolate
.
id
);
);
if
(
result
==
null
)
{
if
(
result
==
null
)
{
throw
'method not available:
$methodName
'
;
throw
DaemonException
(
'method not available:
$methodName
'
)
;
}
}
if
(
result
.
containsKey
(
'error'
))
{
if
(
result
.
containsKey
(
'error'
))
{
...
@@ -756,7 +756,7 @@ class AppDomain extends Domain {
...
@@ -756,7 +756,7 @@ class AppDomain extends Domain {
final
AppInstance
app
=
_getApp
(
appId
);
final
AppInstance
app
=
_getApp
(
appId
);
if
(
app
==
null
)
{
if
(
app
==
null
)
{
throw
"app '
$appId
' not found"
;
throw
DaemonException
(
"app '
$appId
' not found"
)
;
}
}
return
app
.
stop
().
then
<
bool
>(
return
app
.
stop
().
then
<
bool
>(
...
@@ -775,7 +775,7 @@ class AppDomain extends Domain {
...
@@ -775,7 +775,7 @@ class AppDomain extends Domain {
final
AppInstance
app
=
_getApp
(
appId
);
final
AppInstance
app
=
_getApp
(
appId
);
if
(
app
==
null
)
{
if
(
app
==
null
)
{
throw
"app '
$appId
' not found"
;
throw
DaemonException
(
"app '
$appId
' not found"
)
;
}
}
return
app
.
detach
().
then
<
bool
>(
return
app
.
detach
().
then
<
bool
>(
...
@@ -903,7 +903,7 @@ class DeviceDomain extends Domain {
...
@@ -903,7 +903,7 @@ class DeviceDomain extends Domain {
final
Device
device
=
await
daemon
.
deviceDomain
.
_getDevice
(
deviceId
);
final
Device
device
=
await
daemon
.
deviceDomain
.
_getDevice
(
deviceId
);
if
(
device
==
null
)
{
if
(
device
==
null
)
{
throw
"device '
$deviceId
' not found"
;
throw
DaemonException
(
"device '
$deviceId
' not found"
)
;
}
}
hostPort
=
await
device
.
portForwarder
.
forward
(
devicePort
,
hostPort:
hostPort
);
hostPort
=
await
device
.
portForwarder
.
forward
(
devicePort
,
hostPort:
hostPort
);
...
@@ -919,7 +919,7 @@ class DeviceDomain extends Domain {
...
@@ -919,7 +919,7 @@ class DeviceDomain extends Domain {
final
Device
device
=
await
daemon
.
deviceDomain
.
_getDevice
(
deviceId
);
final
Device
device
=
await
daemon
.
deviceDomain
.
_getDevice
(
deviceId
);
if
(
device
==
null
)
{
if
(
device
==
null
)
{
throw
"device '
$deviceId
' not found"
;
throw
DaemonException
(
"device '
$deviceId
' not found"
)
;
}
}
return
device
.
portForwarder
.
unforward
(
ForwardedPort
(
hostPort
,
devicePort
));
return
device
.
portForwarder
.
unforward
(
ForwardedPort
(
hostPort
,
devicePort
));
...
@@ -930,7 +930,7 @@ class DeviceDomain extends Domain {
...
@@ -930,7 +930,7 @@ class DeviceDomain extends Domain {
final
String
deviceId
=
_getStringArg
(
args
,
'deviceId'
,
required:
true
);
final
String
deviceId
=
_getStringArg
(
args
,
'deviceId'
,
required:
true
);
final
Device
device
=
await
daemon
.
deviceDomain
.
_getDevice
(
deviceId
);
final
Device
device
=
await
daemon
.
deviceDomain
.
_getDevice
(
deviceId
);
if
(
device
==
null
)
{
if
(
device
==
null
)
{
throw
"device '
$deviceId
' not found"
;
throw
DaemonException
(
"device '
$deviceId
' not found"
)
;
}
}
final
String
buildMode
=
_getStringArg
(
args
,
'buildMode'
,
required:
true
);
final
String
buildMode
=
_getStringArg
(
args
,
'buildMode'
,
required:
true
);
return
await
device
.
supportsRuntimeMode
(
getBuildModeForName
(
buildMode
));
return
await
device
.
supportsRuntimeMode
(
getBuildModeForName
(
buildMode
));
...
@@ -954,7 +954,7 @@ class DeviceDomain extends Domain {
...
@@ -954,7 +954,7 @@ class DeviceDomain extends Domain {
final
String
deviceId
=
_getStringArg
(
args
,
'deviceId'
,
required:
true
);
final
String
deviceId
=
_getStringArg
(
args
,
'deviceId'
,
required:
true
);
final
Device
device
=
await
daemon
.
deviceDomain
.
_getDevice
(
deviceId
);
final
Device
device
=
await
daemon
.
deviceDomain
.
_getDevice
(
deviceId
);
if
(
device
==
null
)
{
if
(
device
==
null
)
{
throw
"device '
$deviceId
' not found"
;
throw
DaemonException
(
"device '
$deviceId
' not found"
)
;
}
}
final
String
applicationPackageId
=
_getStringArg
(
args
,
'applicationPackageId'
);
final
String
applicationPackageId
=
_getStringArg
(
args
,
'applicationPackageId'
);
final
ApplicationPackage
applicationPackage
=
applicationPackageId
!=
null
?
_applicationPackages
[
applicationPackageId
]
:
null
;
final
ApplicationPackage
applicationPackage
=
applicationPackageId
!=
null
?
_applicationPackages
[
applicationPackageId
]
:
null
;
...
@@ -979,7 +979,7 @@ class DeviceDomain extends Domain {
...
@@ -979,7 +979,7 @@ class DeviceDomain extends Domain {
final
String
deviceId
=
_getStringArg
(
args
,
'deviceId'
,
required:
true
);
final
String
deviceId
=
_getStringArg
(
args
,
'deviceId'
,
required:
true
);
final
Device
device
=
await
daemon
.
deviceDomain
.
_getDevice
(
deviceId
);
final
Device
device
=
await
daemon
.
deviceDomain
.
_getDevice
(
deviceId
);
if
(
device
==
null
)
{
if
(
device
==
null
)
{
throw
"device '
$deviceId
' not found"
;
throw
DaemonException
(
"device '
$deviceId
' not found"
)
;
}
}
final
String
applicationPackageId
=
_getStringArg
(
args
,
'applicationPackageId'
,
required:
true
);
final
String
applicationPackageId
=
_getStringArg
(
args
,
'applicationPackageId'
,
required:
true
);
final
ApplicationPackage
applicationPackage
=
_applicationPackages
[
applicationPackageId
];
final
ApplicationPackage
applicationPackage
=
_applicationPackages
[
applicationPackageId
];
...
@@ -1009,7 +1009,7 @@ class DeviceDomain extends Domain {
...
@@ -1009,7 +1009,7 @@ class DeviceDomain extends Domain {
final
String
deviceId
=
_getStringArg
(
args
,
'deviceId'
,
required:
true
);
final
String
deviceId
=
_getStringArg
(
args
,
'deviceId'
,
required:
true
);
final
Device
device
=
await
daemon
.
deviceDomain
.
_getDevice
(
deviceId
);
final
Device
device
=
await
daemon
.
deviceDomain
.
_getDevice
(
deviceId
);
if
(
device
==
null
)
{
if
(
device
==
null
)
{
throw
"device '
$deviceId
' not found"
;
throw
DaemonException
(
"device '
$deviceId
' not found"
)
;
}
}
final
String
applicationPackageId
=
_getStringArg
(
args
,
'applicationPackageId'
,
required:
true
);
final
String
applicationPackageId
=
_getStringArg
(
args
,
'applicationPackageId'
,
required:
true
);
final
ApplicationPackage
applicationPackage
=
_applicationPackages
[
applicationPackageId
];
final
ApplicationPackage
applicationPackage
=
_applicationPackages
[
applicationPackageId
];
...
@@ -1024,7 +1024,7 @@ class DeviceDomain extends Domain {
...
@@ -1024,7 +1024,7 @@ class DeviceDomain extends Domain {
final
String
deviceId
=
_getStringArg
(
args
,
'deviceId'
,
required:
true
);
final
String
deviceId
=
_getStringArg
(
args
,
'deviceId'
,
required:
true
);
final
Device
device
=
await
daemon
.
deviceDomain
.
_getDevice
(
deviceId
);
final
Device
device
=
await
daemon
.
deviceDomain
.
_getDevice
(
deviceId
);
if
(
device
==
null
)
{
if
(
device
==
null
)
{
throw
"device '
$deviceId
' not found"
;
throw
DaemonException
(
"device '
$deviceId
' not found"
)
;
}
}
final
String
tempFileName
=
'screenshot_
${_id++}
'
;
final
String
tempFileName
=
'screenshot_
${_id++}
'
;
final
File
tempFile
=
daemon
.
proxyDomain
.
tempDirectory
.
childFile
(
tempFileName
);
final
File
tempFile
=
daemon
.
proxyDomain
.
tempDirectory
.
childFile
(
tempFileName
);
...
@@ -1298,9 +1298,9 @@ class EmulatorDomain extends Domain {
...
@@ -1298,9 +1298,9 @@ class EmulatorDomain extends Domain {
final
List
<
Emulator
>
matches
=
final
List
<
Emulator
>
matches
=
await
emulators
.
getEmulatorsMatching
(
emulatorId
);
await
emulators
.
getEmulatorsMatching
(
emulatorId
);
if
(
matches
.
isEmpty
)
{
if
(
matches
.
isEmpty
)
{
throw
"emulator '
$emulatorId
' not found"
;
throw
DaemonException
(
"emulator '
$emulatorId
' not found"
)
;
}
else
if
(
matches
.
length
>
1
)
{
}
else
if
(
matches
.
length
>
1
)
{
throw
"multiple emulators match '
$emulatorId
'"
;
throw
DaemonException
(
"multiple emulators match '
$emulatorId
'"
)
;
}
else
{
}
else
{
await
matches
.
first
.
launch
(
coldBoot:
coldBoot
);
await
matches
.
first
.
launch
(
coldBoot:
coldBoot
);
}
}
...
@@ -1556,3 +1556,13 @@ class DebounceOperationQueue<T, K> {
...
@@ -1556,3 +1556,13 @@ class DebounceOperationQueue<T, K> {
return
completer
.
future
;
return
completer
.
future
;
}
}
}
}
/// Specialized exception for returning errors to the daemon client.
class
DaemonException
implements
Exception
{
DaemonException
(
this
.
message
);
final
String
message
;
@override
String
toString
()
=>
message
;
}
packages/flutter_tools/lib/src/commands/update_packages.dart
View file @
d7688ca0
...
@@ -249,12 +249,7 @@ class UpdatePackagesCommand extends FlutterCommand {
...
@@ -249,12 +249,7 @@ class UpdatePackagesCommand extends FlutterCommand {
bool
needsUpdate
=
false
;
bool
needsUpdate
=
false
;
globals
.
printStatus
(
'Verifying pubspecs...'
);
globals
.
printStatus
(
'Verifying pubspecs...'
);
for
(
final
Directory
directory
in
packages
)
{
for
(
final
Directory
directory
in
packages
)
{
PubspecYaml
pubspec
;
final
PubspecYaml
pubspec
=
PubspecYaml
(
directory
);
try
{
pubspec
=
PubspecYaml
(
directory
);
}
on
String
catch
(
message
)
{
throwToolExit
(
message
);
}
globals
.
printTrace
(
'Reading pubspec.yaml from
${directory.path}
'
);
globals
.
printTrace
(
'Reading pubspec.yaml from
${directory.path}
'
);
if
(
pubspec
.
checksum
.
value
==
null
)
{
if
(
pubspec
.
checksum
.
value
==
null
)
{
// If the checksum is invalid or missing, we can just ask them run to run
// If the checksum is invalid or missing, we can just ask them run to run
...
@@ -310,12 +305,7 @@ class UpdatePackagesCommand extends FlutterCommand {
...
@@ -310,12 +305,7 @@ class UpdatePackagesCommand extends FlutterCommand {
if
(
doUpgrade
)
{
if
(
doUpgrade
)
{
globals
.
printTrace
(
'Reading pubspec.yaml from:
${directory.path}
'
);
globals
.
printTrace
(
'Reading pubspec.yaml from:
${directory.path}
'
);
}
}
PubspecYaml
pubspec
;
final
PubspecYaml
pubspec
=
PubspecYaml
(
directory
);
// this parses the pubspec.yaml
try
{
pubspec
=
PubspecYaml
(
directory
);
// this parses the pubspec.yaml
}
on
String
catch
(
message
)
{
throwToolExit
(
message
);
}
pubspecs
.
add
(
pubspec
);
// remember it for later
pubspecs
.
add
(
pubspec
);
// remember it for later
for
(
final
PubspecDependency
dependency
in
pubspec
.
allDependencies
)
{
for
(
final
PubspecDependency
dependency
in
pubspec
.
allDependencies
)
{
if
(
allDependencies
.
containsKey
(
dependency
.
name
))
{
if
(
allDependencies
.
containsKey
(
dependency
.
name
))
{
...
@@ -721,19 +711,19 @@ class PubspecYaml {
...
@@ -721,19 +711,19 @@ class PubspecYaml {
// If we're entering the "dependencies" section, we want to make sure that
// If we're entering the "dependencies" section, we want to make sure that
// it's the first section (of those we care about) that we've seen so far.
// it's the first section (of those we care about) that we've seen so far.
if
(
seenMain
)
{
if
(
seenMain
)
{
throw
'Two dependencies sections found in
$filename
. There should only be one.'
;
throw
ToolExit
(
'Two dependencies sections found in
$filename
. There should only be one.'
)
;
}
}
if
(
seenDev
)
{
if
(
seenDev
)
{
throw
'The dependencies section was after the dev_dependencies section in
$filename
. '
throw
ToolExit
(
'The dependencies section was after the dev_dependencies section in
$filename
. '
'To enable one-pass processing, the dependencies section must come before the '
'To enable one-pass processing, the dependencies section must come before the '
'dev_dependencies section.'
;
'dev_dependencies section.'
)
;
}
}
seenMain
=
true
;
seenMain
=
true
;
}
else
if
(
section
==
Section
.
devDependencies
)
{
}
else
if
(
section
==
Section
.
devDependencies
)
{
// Similarly, if we're entering the dev_dependencies section, we should verify
// Similarly, if we're entering the dev_dependencies section, we should verify
// that we've not seen one already.
// that we've not seen one already.
if
(
seenDev
)
{
if
(
seenDev
)
{
throw
'Two dev_dependencies sections found in
$filename
. There should only be one.'
;
throw
ToolExit
(
'Two dev_dependencies sections found in
$filename
. There should only be one.'
)
;
}
}
seenDev
=
true
;
seenDev
=
true
;
}
}
...
@@ -774,7 +764,7 @@ class PubspecYaml {
...
@@ -774,7 +764,7 @@ class PubspecYaml {
// First, make sure it's a unique dependency. Listing dependencies
// First, make sure it's a unique dependency. Listing dependencies
// twice doesn't make sense.
// twice doesn't make sense.
if
(
masterDependencies
.
containsKey
(
dependency
.
name
))
{
if
(
masterDependencies
.
containsKey
(
dependency
.
name
))
{
throw
'
$filename
contains two dependencies on
${dependency.name}
.'
;
throw
ToolExit
(
'
$filename
contains two dependencies on
${dependency.name}
.'
)
;
}
}
masterDependencies
[
dependency
.
name
]
=
dependency
;
masterDependencies
[
dependency
.
name
]
=
dependency
;
}
else
{
}
else
{
...
@@ -1306,7 +1296,7 @@ class PubspecDependency extends PubspecLine {
...
@@ -1306,7 +1296,7 @@ class PubspecDependency extends PubspecLine {
_kind
=
DependencyKind
.
git
;
_kind
=
DependencyKind
.
git
;
return
false
;
return
false
;
}
else
{
}
else
{
throw
'Could not parse additional details for dependency
$name
; line was: "
$line
"'
;
throw
ToolExit
(
'Could not parse additional details for dependency
$name
; line was: "
$line
"'
)
;
}
}
_lockIsOverride
=
lockIsOverride
;
_lockIsOverride
=
lockIsOverride
;
_lockLine
=
line
;
_lockLine
=
line
;
...
...
packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
View file @
d7688ca0
...
@@ -536,16 +536,16 @@ class FuchsiaDevice extends Device {
...
@@ -536,16 +536,16 @@ class FuchsiaDevice extends Device {
@override
@override
Future
<
void
>
takeScreenshot
(
File
outputFile
)
async
{
Future
<
void
>
takeScreenshot
(
File
outputFile
)
async
{
if
(
outputFile
.
basename
.
split
(
'.'
).
last
!=
'ppm'
)
{
if
(
outputFile
.
basename
.
split
(
'.'
).
last
!=
'ppm'
)
{
throw
'
${outputFile.path}
must be a .ppm file'
;
throw
Exception
(
'
${outputFile.path}
must be a .ppm file'
)
;
}
}
final
RunResult
screencapResult
=
await
shell
(
'screencap > /tmp/screenshot.ppm'
);
final
RunResult
screencapResult
=
await
shell
(
'screencap > /tmp/screenshot.ppm'
);
if
(
screencapResult
.
exitCode
!=
0
)
{
if
(
screencapResult
.
exitCode
!=
0
)
{
throw
'Could not take a screenshot on device
$name
:
\n
$screencapResult
'
;
throw
Exception
(
'Could not take a screenshot on device
$name
:
\n
$screencapResult
'
)
;
}
}
try
{
try
{
final
RunResult
scpResult
=
await
scp
(
'/tmp/screenshot.ppm'
,
outputFile
.
path
);
final
RunResult
scpResult
=
await
scp
(
'/tmp/screenshot.ppm'
,
outputFile
.
path
);
if
(
scpResult
.
exitCode
!=
0
)
{
if
(
scpResult
.
exitCode
!=
0
)
{
throw
'Failed to copy screenshot from device:
\n
$scpResult
'
;
throw
Exception
(
'Failed to copy screenshot from device:
\n
$scpResult
'
)
;
}
}
}
finally
{
}
finally
{
try
{
try
{
...
...
packages/flutter_tools/lib/src/localizations/localizations_utils.dart
View file @
d7688ca0
...
@@ -156,7 +156,7 @@ Map<String, List<String>> _parseSection(String section) {
...
@@ -156,7 +156,7 @@ Map<String, List<String>> _parseSection(String section) {
}
}
final
int
colon
=
line
.
indexOf
(
':'
);
final
int
colon
=
line
.
indexOf
(
':'
);
if
(
colon
<=
0
)
{
if
(
colon
<=
0
)
{
throw
'not sure how to deal with "
$line
"'
;
throw
Exception
(
'not sure how to deal with "
$line
"'
)
;
}
}
final
String
name
=
line
.
substring
(
0
,
colon
);
final
String
name
=
line
.
substring
(
0
,
colon
);
final
String
value
=
line
.
substring
(
colon
+
2
);
final
String
value
=
line
.
substring
(
colon
+
2
);
...
...
packages/flutter_tools/lib/src/proxied_devices/devices.dart
View file @
d7688ca0
...
@@ -195,7 +195,7 @@ class ProxiedDevice extends Device {
...
@@ -195,7 +195,7 @@ class ProxiedDevice extends Device {
_ProxiedPortForwarder
get
proxiedPortForwarder
=>
_proxiedPortForwarder
??=
_ProxiedPortForwarder
(
connection
,
logger:
_logger
);
_ProxiedPortForwarder
get
proxiedPortForwarder
=>
_proxiedPortForwarder
??=
_ProxiedPortForwarder
(
connection
,
logger:
_logger
);
@override
@override
DevicePortForwarder
get
portForwarder
=>
throw
UnimplementedError
;
DevicePortForwarder
get
portForwarder
=>
throw
UnimplementedError
()
;
@override
@override
void
clearLogs
()
=>
throw
UnimplementedError
();
void
clearLogs
()
=>
throw
UnimplementedError
();
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
d7688ca0
...
@@ -633,7 +633,7 @@ abstract class ResidentHandlers {
...
@@ -633,7 +633,7 @@ abstract class ResidentHandlers {
/// the value of [fullRestart].
/// the value of [fullRestart].
Future
<
OperationResult
>
restart
({
bool
fullRestart
=
false
,
bool
pause
=
false
,
String
reason
})
{
Future
<
OperationResult
>
restart
({
bool
fullRestart
=
false
,
bool
pause
=
false
,
String
reason
})
{
final
String
mode
=
isRunningProfile
?
'profile'
:
isRunningRelease
?
'release'
:
'this'
;
final
String
mode
=
isRunningProfile
?
'profile'
:
isRunningRelease
?
'release'
:
'this'
;
throw
'
${fullRestart ? 'Restart' : 'Reload'}
is not supported in
$mode
mode'
;
throw
Exception
(
'
${fullRestart ? 'Restart' : 'Reload'}
is not supported in
$mode
mode'
)
;
}
}
/// Dump the application's current widget tree to the terminal.
/// Dump the application's current widget tree to the terminal.
...
@@ -1280,7 +1280,7 @@ abstract class ResidentRunner extends ResidentHandlers {
...
@@ -1280,7 +1280,7 @@ abstract class ResidentRunner extends ResidentHandlers {
@required
bool
allowExistingDdsInstance
,
@required
bool
allowExistingDdsInstance
,
})
async
{
})
async
{
if
(!
debuggingOptions
.
debuggingEnabled
)
{
if
(!
debuggingOptions
.
debuggingEnabled
)
{
throw
'The service protocol is not enabled.'
;
throw
Exception
(
'The service protocol is not enabled.'
)
;
}
}
_finished
=
Completer
<
int
>();
_finished
=
Completer
<
int
>();
// Listen for service protocol connection to close.
// Listen for service protocol connection to close.
...
...
packages/flutter_tools/lib/src/run_cold.dart
View file @
d7688ca0
...
@@ -87,8 +87,8 @@ class ColdRunner extends ResidentRunner {
...
@@ -87,8 +87,8 @@ class ColdRunner extends ResidentRunner {
if
(
debuggingEnabled
)
{
if
(
debuggingEnabled
)
{
try
{
try
{
await
connectToServiceProtocol
(
allowExistingDdsInstance:
false
);
await
connectToServiceProtocol
(
allowExistingDdsInstance:
false
);
}
on
String
catch
(
message
)
{
}
on
Exception
catch
(
exception
)
{
globals
.
printError
(
message
);
globals
.
printError
(
exception
.
toString
()
);
appFailedToStart
();
appFailedToStart
();
return
2
;
return
2
;
}
}
...
...
packages/flutter_tools/lib/src/run_hot.dart
View file @
d7688ca0
...
@@ -219,7 +219,7 @@ class HotRunner extends ResidentRunner {
...
@@ -219,7 +219,7 @@ class HotRunner extends ResidentRunner {
}
}
}
}
}
}
throw
'Failed to compile
$expression
'
;
throw
Exception
(
'Failed to compile
$expression
'
)
;
}
}
// Returns the exit code of the flutter tool process, like [run].
// Returns the exit code of the flutter tool process, like [run].
...
...
packages/flutter_tools/lib/src/test/flutter_platform.dart
View file @
d7688ca0
...
@@ -388,7 +388,7 @@ class FlutterPlatform extends PlatformPlugin {
...
@@ -388,7 +388,7 @@ class FlutterPlatform extends PlatformPlugin {
bool
isStatic
,
bool
isStatic
,
)
async
{
)
async
{
if
(
compiler
==
null
||
compiler
.
compiler
==
null
)
{
if
(
compiler
==
null
||
compiler
.
compiler
==
null
)
{
throw
'Compiler is not set up properly to compile
$expression
'
;
throw
Exception
(
'Compiler is not set up properly to compile
$expression
'
)
;
}
}
final
CompilerOutput
compilerOutput
=
final
CompilerOutput
compilerOutput
=
await
compiler
.
compiler
.
compileExpression
(
expression
,
definitions
,
await
compiler
.
compiler
.
compileExpression
(
expression
,
definitions
,
...
@@ -396,7 +396,7 @@ class FlutterPlatform extends PlatformPlugin {
...
@@ -396,7 +396,7 @@ class FlutterPlatform extends PlatformPlugin {
if
(
compilerOutput
!=
null
&&
compilerOutput
.
expressionData
!=
null
)
{
if
(
compilerOutput
!=
null
&&
compilerOutput
.
expressionData
!=
null
)
{
return
base64
.
encode
(
compilerOutput
.
expressionData
);
return
base64
.
encode
(
compilerOutput
.
expressionData
);
}
}
throw
'Failed to compile
$expression
'
;
throw
Exception
(
'Failed to compile
$expression
'
)
;
}
}
TestDevice
_createTestDevice
(
int
ourTestCount
)
{
TestDevice
_createTestDevice
(
int
ourTestCount
)
{
...
...
packages/flutter_tools/test/commands.shard/hermetic/daemon_test.dart
View file @
d7688ca0
...
@@ -660,7 +660,7 @@ void main() {
...
@@ -660,7 +660,7 @@ void main() {
bool
isRunning
=
false
;
bool
isRunning
=
false
;
Future
<
int
>
f
(
int
ret
)
async
{
Future
<
int
>
f
(
int
ret
)
async
{
if
(
isRunning
)
{
if
(
isRunning
)
{
throw
'Functions ran concurrently!'
;
throw
Exception
(
'Functions ran concurrently!'
)
;
}
}
isRunning
=
true
;
isRunning
=
true
;
await
Future
<
void
>.
delayed
(
debounceDuration
*
2
);
await
Future
<
void
>.
delayed
(
debounceDuration
*
2
);
...
...
packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart
View file @
d7688ca0
...
@@ -346,7 +346,7 @@ void main() {
...
@@ -346,7 +346,7 @@ void main() {
'[☠] Crashing validator (the doctor check crashed)
\n
'
'[☠] Crashing validator (the doctor check crashed)
\n
'
' ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, '
' ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, '
'please let us know about this issue at https://github.com/flutter/flutter/issues.
\n
'
'please let us know about this issue at https://github.com/flutter/flutter/issues.
\n
'
' ✗ fatal error
\n
'
' ✗
Bad state:
fatal error
\n
'
'[✓] Validators are fun (with statusInfo)
\n
'
'[✓] Validators are fun (with statusInfo)
\n
'
'[✓] Four score and seven validators ago (with statusInfo)
\n
'
'[✓] Four score and seven validators ago (with statusInfo)
\n
'
'
\n
'
'
\n
'
...
@@ -378,7 +378,7 @@ void main() {
...
@@ -378,7 +378,7 @@ void main() {
'[☠] Async crashing validator (the doctor check crashed)
\n
'
'[☠] Async crashing validator (the doctor check crashed)
\n
'
' ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, '
' ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, '
'please let us know about this issue at https://github.com/flutter/flutter/issues.
\n
'
'please let us know about this issue at https://github.com/flutter/flutter/issues.
\n
'
' ✗ fatal error
\n
'
' ✗
Bad state:
fatal error
\n
'
'[✓] Validators are fun (with statusInfo)
\n
'
'[✓] Validators are fun (with statusInfo)
\n
'
'[✓] Four score and seven validators ago (with statusInfo)
\n
'
'[✓] Four score and seven validators ago (with statusInfo)
\n
'
'
\n
'
'
\n
'
...
@@ -848,7 +848,7 @@ class CrashingValidator extends DoctorValidator {
...
@@ -848,7 +848,7 @@ class CrashingValidator extends DoctorValidator {
@override
@override
Future
<
ValidationResult
>
validate
()
async
{
Future
<
ValidationResult
>
validate
()
async
{
throw
'fatal error'
;
throw
StateError
(
'fatal error'
)
;
}
}
}
}
...
@@ -862,7 +862,7 @@ class AsyncCrashingValidator extends DoctorValidator {
...
@@ -862,7 +862,7 @@ class AsyncCrashingValidator extends DoctorValidator {
const
Duration
delay
=
Duration
(
seconds:
1
);
const
Duration
delay
=
Duration
(
seconds:
1
);
final
Future
<
ValidationResult
>
result
=
Future
<
ValidationResult
>.
delayed
(
delay
)
final
Future
<
ValidationResult
>
result
=
Future
<
ValidationResult
>.
delayed
(
delay
)
.
then
((
_
)
{
.
then
((
_
)
{
throw
'fatal error'
;
throw
StateError
(
'fatal error'
)
;
});
});
_time
.
elapse
(
const
Duration
(
seconds:
1
));
_time
.
elapse
(
const
Duration
(
seconds:
1
));
_time
.
flushMicrotasks
();
_time
.
flushMicrotasks
();
...
...
packages/flutter_tools/test/general.shard/android/android_device_test.dart
View file @
d7688ca0
...
@@ -260,7 +260,7 @@ flutter:
...
@@ -260,7 +260,7 @@ flutter:
]),
]),
androidConsoleSocketFactory:
(
String
host
,
int
port
)
async
{
androidConsoleSocketFactory:
(
String
host
,
int
port
)
async
{
socketWasCreated
=
true
;
socketWasCreated
=
true
;
throw
'Socket was created for non-emulator'
;
throw
Exception
(
'Socket was created for non-emulator'
)
;
}
}
);
);
...
@@ -279,7 +279,7 @@ flutter:
...
@@ -279,7 +279,7 @@ flutter:
]),
]),
androidConsoleSocketFactory:
(
String
host
,
int
port
)
async
{
androidConsoleSocketFactory:
(
String
host
,
int
port
)
async
{
socketWasCreated
=
true
;
socketWasCreated
=
true
;
throw
'Socket was created for emulator without port in ID'
;
throw
Exception
(
'Socket was created for emulator without port in ID'
)
;
},
},
);
);
...
@@ -664,7 +664,7 @@ class FakeWorkingAndroidConsoleSocket extends Fake implements Socket {
...
@@ -664,7 +664,7 @@ class FakeWorkingAndroidConsoleSocket extends Fake implements Socket {
// as part of the previous text to ensure both are handled.
// as part of the previous text to ensure both are handled.
_controller
.
add
(
'OK
\n
'
);
_controller
.
add
(
'OK
\n
'
);
}
else
{
}
else
{
throw
'Unexpected command
$text
'
;
throw
Exception
(
'Unexpected command
$text
'
)
;
}
}
}
}
...
...
packages/flutter_tools/test/general.shard/base/async_guard_test.dart
View file @
d7688ca0
...
@@ -13,25 +13,36 @@ import '../../src/common.dart';
...
@@ -13,25 +13,36 @@ import '../../src/common.dart';
Future
<
void
>
asyncError
()
{
Future
<
void
>
asyncError
()
{
final
Completer
<
void
>
completer
=
Completer
<
void
>();
final
Completer
<
void
>
completer
=
Completer
<
void
>();
final
Completer
<
void
>
errorCompleter
=
Completer
<
void
>();
final
Completer
<
void
>
errorCompleter
=
Completer
<
void
>();
errorCompleter
.
completeError
(
'Async Doom'
,
StackTrace
.
current
);
errorCompleter
.
completeError
(
_CustomException
(
'Async Doom'
)
,
StackTrace
.
current
);
return
completer
.
future
;
return
completer
.
future
;
}
}
/// Specialized exception to be caught.
class
_CustomException
implements
Exception
{
_CustomException
(
this
.
message
);
final
String
message
;
@override
String
toString
()
=>
message
;
}
Future
<
void
>
syncError
()
{
Future
<
void
>
syncError
()
{
throw
'Sync Doom'
;
throw
_CustomException
(
'Sync Doom'
)
;
}
}
Future
<
void
>
syncAndAsyncError
()
{
Future
<
void
>
syncAndAsyncError
()
{
final
Completer
<
void
>
errorCompleter
=
Completer
<
void
>();
final
Completer
<
void
>
errorCompleter
=
Completer
<
void
>();
errorCompleter
.
completeError
(
'Async Doom'
,
StackTrace
.
current
);
errorCompleter
.
completeError
(
_CustomException
(
'Async Doom'
)
,
StackTrace
.
current
);
throw
'Sync Doom'
;
throw
_CustomException
(
'Sync Doom'
)
;
}
}
Future
<
void
>
delayedThrow
(
FakeAsync
time
)
{
Future
<
void
>
delayedThrow
(
FakeAsync
time
)
{
final
Future
<
void
>
result
=
final
Future
<
void
>
result
=
Future
<
void
>.
delayed
(
const
Duration
(
milliseconds:
10
))
Future
<
void
>.
delayed
(
const
Duration
(
milliseconds:
10
))
.
then
((
_
)
async
{
.
then
((
_
)
async
{
throw
'Delayed Doom'
;
throw
_CustomException
(
'Delayed Doom'
)
;
});
});
time
.
elapse
(
const
Duration
(
seconds:
1
));
time
.
elapse
(
const
Duration
(
seconds:
1
));
time
.
flushMicrotasks
();
time
.
flushMicrotasks
();
...
@@ -69,7 +80,7 @@ void main() {
...
@@ -69,7 +80,7 @@ void main() {
try
{
try
{
// Completer is required or else we timeout.
// Completer is required or else we timeout.
await
Future
.
any
(<
Future
<
void
>>[
asyncError
(),
caughtInZone
.
future
]);
await
Future
.
any
(<
Future
<
void
>>[
asyncError
(),
caughtInZone
.
future
]);
}
on
String
{
}
on
_CustomException
{
caughtByHandler
=
true
;
caughtByHandler
=
true
;
}
}
});
});
...
@@ -83,7 +94,7 @@ void main() {
...
@@ -83,7 +94,7 @@ void main() {
try
{
try
{
// Completer is required or else we timeout.
// Completer is required or else we timeout.
await
Future
.
any
(<
Future
<
void
>>[
syncAndAsyncError
(),
caughtInZone
.
future
]);
await
Future
.
any
(<
Future
<
void
>>[
syncAndAsyncError
(),
caughtInZone
.
future
]);
}
on
String
{
}
on
_CustomException
{
caughtByHandler
=
true
;
caughtByHandler
=
true
;
}
}
});
});
...
@@ -96,7 +107,7 @@ void main() {
...
@@ -96,7 +107,7 @@ void main() {
await
zone
.
run
(()
async
{
await
zone
.
run
(()
async
{
try
{
try
{
await
syncError
();
await
syncError
();
}
on
String
{
}
on
_CustomException
{
caughtByHandler
=
true
;
caughtByHandler
=
true
;
}
}
});
});
...
@@ -109,7 +120,7 @@ void main() {
...
@@ -109,7 +120,7 @@ void main() {
await
zone
.
run
(()
async
{
await
zone
.
run
(()
async
{
try
{
try
{
await
asyncGuard
(
syncError
);
await
asyncGuard
(
syncError
);
}
on
String
{
}
on
_CustomException
{
caughtByHandler
=
true
;
caughtByHandler
=
true
;
}
}
});
});
...
@@ -123,7 +134,7 @@ void main() {
...
@@ -123,7 +134,7 @@ void main() {
await
zone
.
run
(()
async
{
await
zone
.
run
(()
async
{
try
{
try
{
await
asyncGuard
(
asyncError
);
await
asyncGuard
(
asyncError
);
}
on
String
{
}
on
_CustomException
{
caughtByHandler
=
true
;
caughtByHandler
=
true
;
}
}
});
});
...
@@ -136,7 +147,7 @@ void main() {
...
@@ -136,7 +147,7 @@ void main() {
await
zone
.
run
(()
async
{
await
zone
.
run
(()
async
{
try
{
try
{
await
asyncGuard
(
syncAndAsyncError
);
await
asyncGuard
(
syncAndAsyncError
);
}
on
String
{
}
on
_CustomException
{
caughtByHandler
=
true
;
caughtByHandler
=
true
;
}
}
});
});
...
@@ -159,7 +170,7 @@ void main() {
...
@@ -159,7 +170,7 @@ void main() {
});
});
try
{
try
{
await
f
;
await
f
;
}
on
String
{
}
on
_CustomException
{
caughtByHandler
=
true
;
caughtByHandler
=
true
;
}
}
if
(!
completer
.
isCompleted
)
{
if
(!
completer
.
isCompleted
)
{
...
@@ -197,7 +208,7 @@ void main() {
...
@@ -197,7 +208,7 @@ void main() {
);
);
try
{
try
{
await
f
;
await
f
;
}
on
String
{
}
on
_CustomException
{
caughtByHandler
=
true
;
caughtByHandler
=
true
;
}
}
if
(!
completer
.
isCompleted
)
{
if
(!
completer
.
isCompleted
)
{
...
@@ -235,7 +246,7 @@ void main() {
...
@@ -235,7 +246,7 @@ void main() {
);
);
try
{
try
{
await
f
;
await
f
;
}
on
String
{
}
on
_CustomException
{
caughtByHandler
=
true
;
caughtByHandler
=
true
;
}
}
if
(!
completer
.
isCompleted
)
{
if
(!
completer
.
isCompleted
)
{
...
@@ -275,7 +286,7 @@ void main() {
...
@@ -275,7 +286,7 @@ void main() {
);
);
try
{
try
{
await
f
;
await
f
;
}
on
String
{
}
on
_CustomException
{
caughtByHandler
=
true
;
caughtByHandler
=
true
;
}
}
if
(!
completer
.
isCompleted
)
{
if
(!
completer
.
isCompleted
)
{
...
...
packages/flutter_tools/test/general.shard/base/error_handling_io_test.dart
View file @
d7688ca0
...
@@ -1240,7 +1240,7 @@ class ThrowsOnCurrentDirectoryFileSystem extends Fake implements FileSystem {
...
@@ -1240,7 +1240,7 @@ class ThrowsOnCurrentDirectoryFileSystem extends Fake implements FileSystem {
}
}
class
FakeExistsFile
extends
Fake
implements
File
{
class
FakeExistsFile
extends
Fake
implements
File
{
late
Object
error
;
late
Exception
error
;
int
existsCount
=
0
;
int
existsCount
=
0
;
...
...
packages/flutter_tools/test/general.shard/base/logger_test.dart
View file @
d7688ca0
...
@@ -1267,7 +1267,7 @@ void main() {
...
@@ -1267,7 +1267,7 @@ void main() {
/// A fake [Logger] that throws the [Invocation] for any method call.
/// A fake [Logger] that throws the [Invocation] for any method call.
class
FakeLogger
implements
Logger
{
class
FakeLogger
implements
Logger
{
@override
@override
dynamic
noSuchMethod
(
Invocation
invocation
)
=>
throw
invocation
;
dynamic
noSuchMethod
(
Invocation
invocation
)
=>
throw
invocation
;
// ignore: only_throw_errors
}
}
/// Returns the [Invocation] thrown from a call to [FakeLogger].
/// Returns the [Invocation] thrown from a call to [FakeLogger].
...
@@ -1309,14 +1309,14 @@ class FakeStdout extends Fake implements Stdout {
...
@@ -1309,14 +1309,14 @@ class FakeStdout extends Fake implements Stdout {
@override
@override
void
write
(
Object
object
)
{
void
write
(
Object
object
)
{
if
(
syncError
)
{
if
(
syncError
)
{
throw
'Error!'
;
throw
Exception
(
'Error!'
)
;
}
}
Zone
.
current
.
runUnaryGuarded
<
void
>((
_
)
{
Zone
.
current
.
runUnaryGuarded
<
void
>((
_
)
{
if
(
completeWithError
)
{
if
(
completeWithError
)
{
_completer
.
completeError
(
Exception
(
'Some pipe error'
));
_completer
.
completeError
(
Exception
(
'Some pipe error'
));
}
else
{
}
else
{
_completer
.
complete
();
_completer
.
complete
();
throw
'Error!'
;
throw
Exception
(
'Error!'
)
;
}
}
},
null
);
},
null
);
}
}
...
...
packages/flutter_tools/test/general.shard/crash_reporting_test.dart
View file @
d7688ca0
...
@@ -381,7 +381,7 @@ class MockCrashReportSender extends MockClient {
...
@@ -381,7 +381,7 @@ class MockCrashReportSender extends MockClient {
}
}
class
CrashingCrashReportSender
extends
MockClient
{
class
CrashingCrashReportSender
extends
MockClient
{
CrashingCrashReportSender
(
Object
exception
)
:
super
((
Request
request
)
async
{
CrashingCrashReportSender
(
Exception
exception
)
:
super
((
Request
request
)
async
{
throw
exception
;
throw
exception
;
});
});
}
}
...
...
packages/flutter_tools/test/general.shard/devfs_test.dart
View file @
d7688ca0
...
@@ -519,7 +519,7 @@ void main() {
...
@@ -519,7 +519,7 @@ void main() {
}
else
if
(
boundaryKey
!=
null
&&
stringData
.
startsWith
(
boundaryKey
))
{
}
else
if
(
boundaryKey
!=
null
&&
stringData
.
startsWith
(
boundaryKey
))
{
yield
utf8
.
encode
(
'result abc2
\n
line1
\n
line2
\n
abc2
\n
abc2 lib/foo.txt.dill 0
\n
'
);
yield
utf8
.
encode
(
'result abc2
\n
line1
\n
line2
\n
abc2
\n
abc2 lib/foo.txt.dill 0
\n
'
);
}
else
{
}
else
{
throw
'Saw
$data
(
$stringData
)'
;
throw
Exception
(
'Saw
$data
(
$stringData
)'
)
;
}
}
processed
++;
processed
++;
}
}
...
...
packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart
View file @
d7688ca0
...
@@ -440,7 +440,11 @@ void main() {
...
@@ -440,7 +440,11 @@ void main() {
final
FuchsiaDevice
device
=
FuchsiaDevice
(
'id'
,
name:
'tester'
);
final
FuchsiaDevice
device
=
FuchsiaDevice
(
'id'
,
name:
'tester'
);
await
expectLater
(
await
expectLater
(
()
=>
device
.
takeScreenshot
(
globals
.
fs
.
file
(
'file.invalid'
)),
()
=>
device
.
takeScreenshot
(
globals
.
fs
.
file
(
'file.invalid'
)),
throwsA
(
equals
(
'file.invalid must be a .ppm file'
)),
throwsA
(
isA
<
Exception
>().
having
(
(
Exception
exception
)
=>
exception
.
toString
(),
'message'
,
contains
(
'file.invalid must be a .ppm file'
)
)),
);
);
});
});
...
@@ -460,7 +464,11 @@ void main() {
...
@@ -460,7 +464,11 @@ void main() {
await
expectLater
(
await
expectLater
(
()
=>
device
.
takeScreenshot
(
globals
.
fs
.
file
(
'file.ppm'
)),
()
=>
device
.
takeScreenshot
(
globals
.
fs
.
file
(
'file.ppm'
)),
throwsA
(
equals
(
'Could not take a screenshot on device tester:
\n
<error-message>'
)),
throwsA
(
isA
<
Exception
>().
having
(
(
Exception
exception
)
=>
exception
.
toString
(),
'message'
,
contains
(
'Could not take a screenshot on device tester:
\n
<error-message>'
)
)),
);
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
processManager
,
ProcessManager:
()
=>
processManager
,
...
@@ -506,7 +514,11 @@ void main() {
...
@@ -506,7 +514,11 @@ void main() {
await
expectLater
(
await
expectLater
(
()
=>
device
.
takeScreenshot
(
globals
.
fs
.
file
(
'file.ppm'
)),
()
=>
device
.
takeScreenshot
(
globals
.
fs
.
file
(
'file.ppm'
)),
throwsA
(
equals
(
'Failed to copy screenshot from device:
\n
<error-message>'
)),
throwsA
(
isA
<
Exception
>().
having
(
(
Exception
exception
)
=>
exception
.
toString
(),
'message'
,
contains
(
'Failed to copy screenshot from device:
\n
<error-message>'
)
)),
);
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
processManager
,
ProcessManager:
()
=>
processManager
,
...
...
packages/flutter_tools/test/general.shard/hot_test.dart
View file @
d7688ca0
...
@@ -465,7 +465,7 @@ void main() {
...
@@ -465,7 +465,7 @@ void main() {
final
List
<
FlutterDevice
>
devices
=
<
FlutterDevice
>[
final
List
<
FlutterDevice
>
devices
=
<
FlutterDevice
>[
fakeFlutterDevice
,
fakeFlutterDevice
,
];
];
fakeFlutterDevice
.
updateDevFSReportCallback
=
()
async
=>
throw
'updateDevFS failed'
;
fakeFlutterDevice
.
updateDevFSReportCallback
=
()
async
=>
throw
Exception
(
'updateDevFS failed'
)
;
final
HotRunner
runner
=
HotRunner
(
final
HotRunner
runner
=
HotRunner
(
devices
,
devices
,
...
@@ -474,7 +474,7 @@ void main() {
...
@@ -474,7 +474,7 @@ void main() {
devtoolsHandler:
createNoOpHandler
,
devtoolsHandler:
createNoOpHandler
,
);
);
await
expectLater
(
runner
.
restart
(
fullRestart:
true
),
throwsA
(
'updateDevFS failed'
));
await
expectLater
(
runner
.
restart
(
fullRestart:
true
),
throwsA
(
isA
<
Exception
>().
having
((
Exception
e
)
=>
e
.
toString
(),
'message'
,
'Exception: updateDevFS failed'
)
));
expect
(
testingConfig
.
updateDevFSCompleteCalled
,
true
);
expect
(
testingConfig
.
updateDevFSCompleteCalled
,
true
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
HotRunnerConfig:
()
=>
testingConfig
,
HotRunnerConfig:
()
=>
testingConfig
,
...
@@ -499,7 +499,7 @@ void main() {
...
@@ -499,7 +499,7 @@ void main() {
final
List
<
FlutterDevice
>
devices
=
<
FlutterDevice
>[
final
List
<
FlutterDevice
>
devices
=
<
FlutterDevice
>[
fakeFlutterDevice
,
fakeFlutterDevice
,
];
];
fakeFlutterDevice
.
updateDevFSReportCallback
=
()
async
=>
throw
'updateDevFS failed'
;
fakeFlutterDevice
.
updateDevFSReportCallback
=
()
async
=>
throw
Exception
(
'updateDevFS failed'
)
;
final
HotRunner
runner
=
HotRunner
(
final
HotRunner
runner
=
HotRunner
(
devices
,
devices
,
...
@@ -508,7 +508,7 @@ void main() {
...
@@ -508,7 +508,7 @@ void main() {
devtoolsHandler:
createNoOpHandler
,
devtoolsHandler:
createNoOpHandler
,
);
);
await
expectLater
(
runner
.
restart
(),
throwsA
(
'updateDevFS failed'
));
await
expectLater
(
runner
.
restart
(),
throwsA
(
isA
<
Exception
>().
having
((
Exception
e
)
=>
e
.
toString
(),
'message'
,
'Exception: updateDevFS failed'
)
));
expect
(
testingConfig
.
updateDevFSCompleteCalled
,
true
);
expect
(
testingConfig
.
updateDevFSCompleteCalled
,
true
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
HotRunnerConfig:
()
=>
testingConfig
,
HotRunnerConfig:
()
=>
testingConfig
,
...
...
packages/flutter_tools/test/general.shard/project_test.dart
View file @
d7688ca0
...
@@ -925,7 +925,7 @@ void transfer(FileSystemEntity entity, FileSystem target) {
...
@@ -925,7 +925,7 @@ void transfer(FileSystemEntity entity, FileSystem target) {
}
else
if
(
entity
is
File
)
{
}
else
if
(
entity
is
File
)
{
target
.
file
(
entity
.
absolute
.
path
).
writeAsBytesSync
(
entity
.
readAsBytesSync
(),
flush:
true
);
target
.
file
(
entity
.
absolute
.
path
).
writeAsBytesSync
(
entity
.
readAsBytesSync
(),
flush:
true
);
}
else
{
}
else
{
throw
'Unsupported FileSystemEntity
${entity.runtimeType}
'
;
throw
Exception
(
'Unsupported FileSystemEntity
${entity.runtimeType}
'
)
;
}
}
}
}
...
...
packages/flutter_tools/test/general.shard/protocol_discovery_test.dart
View file @
d7688ca0
...
@@ -405,11 +405,11 @@ class MockPortForwarder extends DevicePortForwarder {
...
@@ -405,11 +405,11 @@ class MockPortForwarder extends DevicePortForwarder {
}
}
@override
@override
List
<
ForwardedPort
>
get
forwardedPorts
=>
throw
'not implemented'
;
List
<
ForwardedPort
>
get
forwardedPorts
=>
throw
UnimplementedError
()
;
@override
@override
Future
<
void
>
unforward
(
ForwardedPort
forwardedPort
)
{
Future
<
void
>
unforward
(
ForwardedPort
forwardedPort
)
{
throw
'not implemented'
;
throw
UnimplementedError
()
;
}
}
@override
@override
...
...
packages/flutter_tools/test/general.shard/resident_runner_test.dart
View file @
d7688ca0
...
@@ -2142,8 +2142,8 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
...
@@ -2142,8 +2142,8 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
success:
true
,
success:
true
,
invalidatedSourcesCount:
1
,
invalidatedSourcesCount:
1
,
);
);
Object
reportError
;
Exception
reportError
;
Object
runColdError
;
Exception
runColdError
;
int
runHotCode
=
0
;
int
runHotCode
=
0
;
int
runColdCode
=
0
;
int
runColdCode
=
0
;
...
...
packages/flutter_tools/test/general.shard/resident_web_runner_test.dart
View file @
d7688ca0
...
@@ -1225,6 +1225,8 @@ class FakeWebDevFS extends Fake implements WebDevFS {
...
@@ -1225,6 +1225,8 @@ class FakeWebDevFS extends Fake implements WebDevFS {
@override
@override
Future
<
ConnectionResult
>
connect
(
bool
useDebugExtension
)
async
{
Future
<
ConnectionResult
>
connect
(
bool
useDebugExtension
)
async
{
if
(
exception
!=
null
)
{
if
(
exception
!=
null
)
{
assert
(
exception
is
Exception
||
exception
is
Error
);
// ignore: only_throw_errors, exception is either Error or Exception here.
throw
exception
;
throw
exception
;
}
}
return
result
;
return
result
;
...
@@ -1299,7 +1301,7 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
...
@@ -1299,7 +1301,7 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
success:
true
,
success:
true
,
invalidatedSourcesCount:
1
,
invalidatedSourcesCount:
1
,
);
);
Object
reportError
;
Exception
reportError
;
@override
@override
ResidentCompiler
generator
;
ResidentCompiler
generator
;
...
...
packages/flutter_tools/test/general.shard/runner/runner_test.dart
View file @
d7688ca0
...
@@ -44,7 +44,7 @@ void main() {
...
@@ -44,7 +44,7 @@ void main() {
// TODO(jamesderlin): Ideally only the first call to exit() would be
// TODO(jamesderlin): Ideally only the first call to exit() would be
// honored and subsequent calls would be no-ops, but existing tests
// honored and subsequent calls would be no-ops, but existing tests
// rely on all calls to throw.
// rely on all calls to throw.
throw
'test exit'
;
throw
Exception
(
'test exit'
)
;
});
});
Cache
.
disableLocking
();
Cache
.
disableLocking
();
...
@@ -75,7 +75,7 @@ void main() {
...
@@ -75,7 +75,7 @@ void main() {
onError:
(
Object
error
,
StackTrace
stack
)
{
// ignore: deprecated_member_use
onError:
(
Object
error
,
StackTrace
stack
)
{
// ignore: deprecated_member_use
expect
(
firstExitCode
,
isNotNull
);
expect
(
firstExitCode
,
isNotNull
);
expect
(
firstExitCode
,
isNot
(
0
));
expect
(
firstExitCode
,
isNot
(
0
));
expect
(
error
,
'
test exit'
);
expect
(
error
.
toString
(),
'Exception:
test exit'
);
completer
.
complete
();
completer
.
complete
();
},
},
));
));
...
@@ -88,7 +88,7 @@ void main() {
...
@@ -88,7 +88,7 @@ void main() {
// *original* crash, and not the crash from the first crash report
// *original* crash, and not the crash from the first crash report
// attempt.
// attempt.
final
CrashingUsage
crashingUsage
=
globals
.
flutterUsage
as
CrashingUsage
;
final
CrashingUsage
crashingUsage
=
globals
.
flutterUsage
as
CrashingUsage
;
expect
(
crashingUsage
.
sentException
,
'
an exception % --'
);
expect
(
crashingUsage
.
sentException
.
toString
(),
'Exception:
an exception % --'
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
FakePlatform
(
environment:
<
String
,
String
>{
Platform:
()
=>
FakePlatform
(
environment:
<
String
,
String
>{
'FLUTTER_ANALYTICS_LOG_FILE'
:
'test'
,
'FLUTTER_ANALYTICS_LOG_FILE'
:
'test'
,
...
@@ -127,7 +127,7 @@ void main() {
...
@@ -127,7 +127,7 @@ void main() {
onError:
(
Object
error
,
StackTrace
stack
)
{
// ignore: deprecated_member_use
onError:
(
Object
error
,
StackTrace
stack
)
{
// ignore: deprecated_member_use
expect
(
firstExitCode
,
isNotNull
);
expect
(
firstExitCode
,
isNotNull
);
expect
(
firstExitCode
,
isNot
(
0
));
expect
(
firstExitCode
,
isNot
(
0
));
expect
(
error
,
'
test exit'
);
expect
(
error
.
toString
(),
'Exception:
test exit'
);
completer
.
complete
();
completer
.
complete
();
},
},
));
));
...
@@ -174,7 +174,7 @@ void main() {
...
@@ -174,7 +174,7 @@ void main() {
onError:
(
Object
error
,
StackTrace
stack
)
{
// ignore: deprecated_member_use
onError:
(
Object
error
,
StackTrace
stack
)
{
// ignore: deprecated_member_use
expect
(
firstExitCode
,
isNotNull
);
expect
(
firstExitCode
,
isNotNull
);
expect
(
firstExitCode
,
isNot
(
0
));
expect
(
firstExitCode
,
isNot
(
0
));
expect
(
error
,
'
test exit'
);
expect
(
error
.
toString
(),
'Exception:
test exit'
);
completer
.
complete
();
completer
.
complete
();
},
},
));
));
...
@@ -183,20 +183,20 @@ void main() {
...
@@ -183,20 +183,20 @@ void main() {
final
String
errorText
=
testLogger
.
errorText
;
final
String
errorText
=
testLogger
.
errorText
;
expect
(
expect
(
errorText
,
errorText
,
containsIgnoringWhitespace
(
'Oops; flutter has exited unexpectedly: "an exception % --".
\n
'
),
containsIgnoringWhitespace
(
'Oops; flutter has exited unexpectedly: "
Exception:
an exception % --".
\n
'
),
);
);
final
File
log
=
globals
.
fs
.
file
(
'/flutter_01.log'
);
final
File
log
=
globals
.
fs
.
file
(
'/flutter_01.log'
);
final
String
logContents
=
log
.
readAsStringSync
();
final
String
logContents
=
log
.
readAsStringSync
();
expect
(
logContents
,
contains
(
kCustomBugInstructions
));
expect
(
logContents
,
contains
(
kCustomBugInstructions
));
expect
(
logContents
,
contains
(
'flutter crash'
));
expect
(
logContents
,
contains
(
'flutter crash'
));
expect
(
logContents
,
contains
(
'
String
: an exception % --'
));
expect
(
logContents
,
contains
(
'
Exception
: an exception % --'
));
expect
(
logContents
,
contains
(
'CrashingFlutterCommand.runCommand'
));
expect
(
logContents
,
contains
(
'CrashingFlutterCommand.runCommand'
));
expect
(
logContents
,
contains
(
'[✓] Flutter'
));
expect
(
logContents
,
contains
(
'[✓] Flutter'
));
final
CrashDetails
sentDetails
=
(
globals
.
crashReporter
as
WaitingCrashReporter
).
_details
;
final
CrashDetails
sentDetails
=
(
globals
.
crashReporter
as
WaitingCrashReporter
).
_details
;
expect
(
sentDetails
.
command
,
'flutter crash'
);
expect
(
sentDetails
.
command
,
'flutter crash'
);
expect
(
sentDetails
.
error
,
'
an exception % --'
);
expect
(
sentDetails
.
error
.
toString
(),
'Exception:
an exception % --'
);
expect
(
sentDetails
.
stackTrace
.
toString
(),
contains
(
'CrashingFlutterCommand.runCommand'
));
expect
(
sentDetails
.
stackTrace
.
toString
(),
contains
(
'CrashingFlutterCommand.runCommand'
));
expect
(
await
sentDetails
.
doctorText
.
text
,
contains
(
'[✓] Flutter'
));
expect
(
await
sentDetails
.
doctorText
.
text
,
contains
(
'[✓] Flutter'
));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
...
@@ -234,7 +234,7 @@ class CrashingFlutterCommand extends FlutterCommand {
...
@@ -234,7 +234,7 @@ class CrashingFlutterCommand extends FlutterCommand {
@override
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
const
String
error
=
'an exception % --'
;
// Test URL encoding.
final
Exception
error
=
Exception
(
'an exception % --'
)
;
// Test URL encoding.
if
(!
_asyncCrash
)
{
if
(!
_asyncCrash
)
{
throw
error
;
throw
error
;
}
}
...
@@ -270,7 +270,7 @@ class CrashingUsage implements Usage {
...
@@ -270,7 +270,7 @@ class CrashingUsage implements Usage {
void
sendException
(
dynamic
exception
)
{
void
sendException
(
dynamic
exception
)
{
if
(
_firstAttempt
)
{
if
(
_firstAttempt
)
{
_firstAttempt
=
false
;
_firstAttempt
=
false
;
throw
'CrashingUsage.sendException'
;
throw
Exception
(
'CrashingUsage.sendException'
)
;
}
}
_sentException
=
exception
;
_sentException
=
exception
;
}
}
...
...
packages/flutter_tools/test/integration.shard/debug_adapter/test_client.dart
View file @
d7688ca0
...
@@ -76,7 +76,7 @@ class DapTestClient {
...
@@ -76,7 +76,7 @@ class DapTestClient {
/// Returns a Future that completes with the next [event] event.
/// Returns a Future that completes with the next [event] event.
Future
<
Event
>
event
(
String
event
)
=>
_eventController
.
stream
.
firstWhere
(
Future
<
Event
>
event
(
String
event
)
=>
_eventController
.
stream
.
firstWhere
(
(
Event
e
)
=>
e
.
event
==
event
,
(
Event
e
)
=>
e
.
event
==
event
,
orElse:
()
=>
throw
'Did not receive
$event
event before stream closed'
);
orElse:
()
=>
throw
Exception
(
'Did not receive
$event
event before stream closed'
)
);
/// Returns a stream for [event] events.
/// Returns a stream for [event] events.
Stream
<
Event
>
events
(
String
event
)
{
Stream
<
Event
>
events
(
String
event
)
{
...
@@ -190,13 +190,13 @@ class DapTestClient {
...
@@ -190,13 +190,13 @@ class DapTestClient {
/// event for [extension].
/// event for [extension].
Future
<
Map
<
String
,
Object
?>>
serviceExtensionAdded
(
String
extension
)
=>
serviceExtensionAddedEvents
.
firstWhere
(
Future
<
Map
<
String
,
Object
?>>
serviceExtensionAdded
(
String
extension
)
=>
serviceExtensionAddedEvents
.
firstWhere
(
(
Map
<
String
,
Object
?>
body
)
=>
body
[
'extensionRPC'
]
==
extension
,
(
Map
<
String
,
Object
?>
body
)
=>
body
[
'extensionRPC'
]
==
extension
,
orElse:
()
=>
throw
'Did not receive
$extension
extension added event before stream closed'
);
orElse:
()
=>
throw
Exception
(
'Did not receive
$extension
extension added event before stream closed'
)
);
/// Returns a Future that completes with the next serviceExtensionStateChanged
/// Returns a Future that completes with the next serviceExtensionStateChanged
/// event for [extension].
/// event for [extension].
Future
<
Map
<
String
,
Object
?>>
serviceExtensionStateChanged
(
String
extension
)
=>
serviceExtensionStateChangedEvents
.
firstWhere
(
Future
<
Map
<
String
,
Object
?>>
serviceExtensionStateChanged
(
String
extension
)
=>
serviceExtensionStateChangedEvents
.
firstWhere
(
(
Map
<
String
,
Object
?>
body
)
=>
body
[
'extension'
]
==
extension
,
(
Map
<
String
,
Object
?>
body
)
=>
body
[
'extension'
]
==
extension
,
orElse:
()
=>
throw
'Did not receive
$extension
extension state changed event before stream closed'
);
orElse:
()
=>
throw
Exception
(
'Did not receive
$extension
extension state changed event before stream closed'
)
);
/// Initializes the debug adapter and launches [program]/[cwd] or calls the
/// Initializes the debug adapter and launches [program]/[cwd] or calls the
/// custom [launch] method.
/// custom [launch] method.
...
...
packages/flutter_tools/test/integration.shard/debug_adapter/test_server.dart
View file @
d7688ca0
...
@@ -81,14 +81,14 @@ class OutOfProcessDapTestServer extends DapTestServer {
...
@@ -81,14 +81,14 @@ class OutOfProcessDapTestServer extends DapTestServer {
.
listen
((
String
error
)
{
.
listen
((
String
error
)
{
logger
?.
call
(
error
);
logger
?.
call
(
error
);
if
(!
_isShuttingDown
)
{
if
(!
_isShuttingDown
)
{
throw
error
;
throw
Exception
(
error
)
;
}
}
});
});
unawaited
(
_process
.
exitCode
.
then
((
int
code
)
{
unawaited
(
_process
.
exitCode
.
then
((
int
code
)
{
final
String
message
=
'Out-of-process DAP server terminated with code
$code
'
;
final
String
message
=
'Out-of-process DAP server terminated with code
$code
'
;
logger
?.
call
(
message
);
logger
?.
call
(
message
);
if
(!
_isShuttingDown
&&
code
!=
0
)
{
if
(!
_isShuttingDown
&&
code
!=
0
)
{
throw
message
;
throw
Exception
(
message
)
;
}
}
}));
}));
}
}
...
...
packages/flutter_tools/test/integration.shard/hot_reload_errors_test.dart
View file @
d7688ca0
...
@@ -31,6 +31,6 @@ void main() {
...
@@ -31,6 +31,6 @@ void main() {
await
flutter
.
run
();
await
flutter
.
run
();
project
.
removeFieldFromConstClass
();
project
.
removeFieldFromConstClass
();
expect
(
flutter
.
hotReload
(),
throwsA
(
contains
(
'Try performing a hot restart instead.'
)));
expect
(
flutter
.
hotReload
(),
throwsA
(
isA
<
Exception
>().
having
((
Exception
e
)
=>
e
.
toString
(),
'message'
,
contains
(
'Try performing a hot restart instead.'
)
)));
});
});
}
}
packages/flutter_tools/test/integration.shard/test_driver.dart
View file @
d7688ca0
...
@@ -482,7 +482,7 @@ abstract class FlutterTestDriver {
...
@@ -482,7 +482,7 @@ abstract class FlutterTestDriver {
timeoutExpired
=
true
;
timeoutExpired
=
true
;
_debugPrint
(
messages
.
toString
());
_debugPrint
(
messages
.
toString
());
}
}
throw
error
;
throw
error
;
// ignore: only_throw_errors
}).
whenComplete
(()
=>
subscription
.
cancel
());
}).
whenComplete
(()
=>
subscription
.
cancel
());
}
}
}
}
...
@@ -753,7 +753,7 @@ class FlutterRunTestDriver extends FlutterTestDriver {
...
@@ -753,7 +753,7 @@ class FlutterRunTestDriver extends FlutterTestDriver {
}
}
void
_throwErrorResponse
(
String
message
)
{
void
_throwErrorResponse
(
String
message
)
{
throw
'
$message
\n\n
$_lastResponse
\n\n
${_errorBuffer.toString()}
'
.
trim
(
);
throw
Exception
(
'
$message
\n\n
$_lastResponse
\n\n
${_errorBuffer.toString()}
'
.
trim
()
);
}
}
final
bool
spawnDdsInstance
;
final
bool
spawnDdsInstance
;
...
...
packages/flutter_tools/test/src/context.dart
View file @
d7688ca0
...
@@ -153,7 +153,7 @@ void testUsingContext(
...
@@ -153,7 +153,7 @@ void testUsingContext(
print
(
error
);
// ignore: avoid_print
print
(
error
);
// ignore: avoid_print
print
(
stackTrace
);
// ignore: avoid_print
print
(
stackTrace
);
// ignore: avoid_print
_printBufferedErrors
(
context
);
_printBufferedErrors
(
context
);
throw
error
;
throw
error
;
//ignore: only_throw_errors
});
});
},
},
);
);
...
@@ -348,10 +348,10 @@ class LocalFileSystemBlockingSetCurrentDirectory extends LocalFileSystem {
...
@@ -348,10 +348,10 @@ class LocalFileSystemBlockingSetCurrentDirectory extends LocalFileSystem {
@override
@override
set
currentDirectory
(
dynamic
value
)
{
set
currentDirectory
(
dynamic
value
)
{
throw
'globals.fs.currentDirectory should not be set on the local file system during '
throw
Exception
(
'globals.fs.currentDirectory should not be set on the local file system during '
'tests as this can cause race conditions with concurrent tests. '
'tests as this can cause race conditions with concurrent tests. '
'Consider using a MemoryFileSystem for testing if possible or refactor '
'Consider using a MemoryFileSystem for testing if possible or refactor '
'code to not require setting globals.fs.currentDirectory.'
;
'code to not require setting globals.fs.currentDirectory.'
)
;
}
}
}
}
...
...
packages/flutter_tools/test/src/fake_process_manager.dart
View file @
d7688ca0
...
@@ -258,7 +258,8 @@ abstract class FakeProcessManager implements ProcessManager {
...
@@ -258,7 +258,8 @@ abstract class FakeProcessManager implements ProcessManager {
_pid
+=
1
;
_pid
+=
1
;
final
FakeCommand
fakeCommand
=
findCommand
(
command
,
workingDirectory
,
environment
,
encoding
);
final
FakeCommand
fakeCommand
=
findCommand
(
command
,
workingDirectory
,
environment
,
encoding
);
if
(
fakeCommand
.
exception
!=
null
)
{
if
(
fakeCommand
.
exception
!=
null
)
{
throw
fakeCommand
.
exception
!;
assert
(
fakeCommand
.
exception
is
Exception
||
fakeCommand
.
exception
is
Error
);
throw
fakeCommand
.
exception
!;
// ignore: only_throw_errors
}
}
if
(
fakeCommand
.
onRun
!=
null
)
{
if
(
fakeCommand
.
onRun
!=
null
)
{
fakeCommand
.
onRun
!();
fakeCommand
.
onRun
!();
...
...
packages/flutter_tools/test/src/test_build_system.dart
View file @
d7688ca0
...
@@ -27,7 +27,7 @@ class TestBuildSystem implements BuildSystem {
...
@@ -27,7 +27,7 @@ class TestBuildSystem implements BuildSystem {
final
List
<
BuildResult
>
_results
;
final
List
<
BuildResult
>
_results
;
final
BuildResult
?
_singleResult
;
final
BuildResult
?
_singleResult
;
final
Object
?
_exception
;
final
Exception
?
_exception
;
final
void
Function
(
Target
target
,
Environment
environment
)?
_onRun
;
final
void
Function
(
Target
target
,
Environment
environment
)?
_onRun
;
int
_nextResult
=
0
;
int
_nextResult
=
0
;
...
...
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