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:
curly_braces_in_flow_control_structures
:
true
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.
only_throw_errors
:
false
# For historical reasons we throw strings a lot.
only_throw_errors
:
true
prefer_relative_imports
:
true
public_member_api_docs
:
false
# Tool does not have any public API.
unawaited_futures
:
true
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
d7688ca0
...
...
@@ -212,13 +212,13 @@ class Daemon {
final
String
method
=
request
.
data
[
'method'
]
as
String
;
assert
(
method
!=
null
);
if
(!
method
.
contains
(
'.'
))
{
throw
'method not understood:
$method
'
;
throw
DaemonException
(
'method not understood:
$method
'
)
;
}
final
String
prefix
=
method
.
substring
(
0
,
method
.
indexOf
(
'.'
));
final
String
name
=
method
.
substring
(
method
.
indexOf
(
'.'
)
+
1
);
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
);
...
...
@@ -275,7 +275,7 @@ abstract class Domain {
}
else
if
(
_handlersWithBinary
.
containsKey
(
command
))
{
return
_handlersWithBinary
[
command
](
args
,
binary
);
}
throw
'command not understood:
$name
.
$command
'
;
throw
DaemonException
(
'command not understood:
$name
.
$command
'
)
;
}).
then
<
dynamic
>((
dynamic
result
)
{
daemon
.
connection
.
sendResponse
(
id
,
_toJsonable
(
result
));
}).
catchError
((
Object
error
,
StackTrace
stackTrace
)
{
...
...
@@ -289,33 +289,33 @@ abstract class Domain {
String
_getStringArg
(
Map
<
String
,
dynamic
>
args
,
String
name
,
{
bool
required
=
false
})
{
if
(
required
&&
!
args
.
containsKey
(
name
))
{
throw
'
$name
is required'
;
throw
DaemonException
(
'
$name
is required'
)
;
}
final
dynamic
val
=
args
[
name
];
if
(
val
!=
null
&&
val
is
!
String
)
{
throw
'
$name
is not a String'
;
throw
DaemonException
(
'
$name
is not a String'
)
;
}
return
val
as
String
;
}
bool
_getBoolArg
(
Map
<
String
,
dynamic
>
args
,
String
name
,
{
bool
required
=
false
})
{
if
(
required
&&
!
args
.
containsKey
(
name
))
{
throw
'
$name
is required'
;
throw
DaemonException
(
'
$name
is required'
)
;
}
final
dynamic
val
=
args
[
name
];
if
(
val
!=
null
&&
val
is
!
bool
)
{
throw
'
$name
is not a bool'
;
throw
DaemonException
(
'
$name
is not a bool'
)
;
}
return
val
as
bool
;
}
int
_getIntArg
(
Map
<
String
,
dynamic
>
args
,
String
name
,
{
bool
required
=
false
})
{
if
(
required
&&
!
args
.
containsKey
(
name
))
{
throw
'
$name
is required'
;
throw
DaemonException
(
'
$name
is required'
)
;
}
final
dynamic
val
=
args
[
name
];
if
(
val
!=
null
&&
val
is
!
int
)
{
throw
'
$name
is not an int'
;
throw
DaemonException
(
'
$name
is not an int'
)
;
}
return
val
as
int
;
}
...
...
@@ -670,7 +670,7 @@ class AppDomain extends Domain {
final
AppInstance
app
=
_getApp
(
appId
);
if
(
app
==
null
)
{
throw
"app '
$appId
' not found"
;
throw
DaemonException
(
"app '
$appId
' not found"
)
;
}
return
_queueAndDebounceReloadAction
(
...
...
@@ -728,7 +728,7 @@ class AppDomain extends Domain {
final
AppInstance
app
=
_getApp
(
appId
);
if
(
app
==
null
)
{
throw
"app '
$appId
' not found"
;
throw
DaemonException
(
"app '
$appId
' not found"
)
;
}
final
FlutterDevice
device
=
app
.
runner
.
flutterDevices
.
first
;
final
List
<
FlutterView
>
views
=
await
device
.
vmService
.
getFlutterViews
();
...
...
@@ -741,7 +741,7 @@ class AppDomain extends Domain {
.
first
.
uiIsolate
.
id
);
if
(
result
==
null
)
{
throw
'method not available:
$methodName
'
;
throw
DaemonException
(
'method not available:
$methodName
'
)
;
}
if
(
result
.
containsKey
(
'error'
))
{
...
...
@@ -756,7 +756,7 @@ class AppDomain extends Domain {
final
AppInstance
app
=
_getApp
(
appId
);
if
(
app
==
null
)
{
throw
"app '
$appId
' not found"
;
throw
DaemonException
(
"app '
$appId
' not found"
)
;
}
return
app
.
stop
().
then
<
bool
>(
...
...
@@ -775,7 +775,7 @@ class AppDomain extends Domain {
final
AppInstance
app
=
_getApp
(
appId
);
if
(
app
==
null
)
{
throw
"app '
$appId
' not found"
;
throw
DaemonException
(
"app '
$appId
' not found"
)
;
}
return
app
.
detach
().
then
<
bool
>(
...
...
@@ -903,7 +903,7 @@ class DeviceDomain extends Domain {
final
Device
device
=
await
daemon
.
deviceDomain
.
_getDevice
(
deviceId
);
if
(
device
==
null
)
{
throw
"device '
$deviceId
' not found"
;
throw
DaemonException
(
"device '
$deviceId
' not found"
)
;
}
hostPort
=
await
device
.
portForwarder
.
forward
(
devicePort
,
hostPort:
hostPort
);
...
...
@@ -919,7 +919,7 @@ class DeviceDomain extends Domain {
final
Device
device
=
await
daemon
.
deviceDomain
.
_getDevice
(
deviceId
);
if
(
device
==
null
)
{
throw
"device '
$deviceId
' not found"
;
throw
DaemonException
(
"device '
$deviceId
' not found"
)
;
}
return
device
.
portForwarder
.
unforward
(
ForwardedPort
(
hostPort
,
devicePort
));
...
...
@@ -930,7 +930,7 @@ class DeviceDomain extends Domain {
final
String
deviceId
=
_getStringArg
(
args
,
'deviceId'
,
required:
true
);
final
Device
device
=
await
daemon
.
deviceDomain
.
_getDevice
(
deviceId
);
if
(
device
==
null
)
{
throw
"device '
$deviceId
' not found"
;
throw
DaemonException
(
"device '
$deviceId
' not found"
)
;
}
final
String
buildMode
=
_getStringArg
(
args
,
'buildMode'
,
required:
true
);
return
await
device
.
supportsRuntimeMode
(
getBuildModeForName
(
buildMode
));
...
...
@@ -954,7 +954,7 @@ class DeviceDomain extends Domain {
final
String
deviceId
=
_getStringArg
(
args
,
'deviceId'
,
required:
true
);
final
Device
device
=
await
daemon
.
deviceDomain
.
_getDevice
(
deviceId
);
if
(
device
==
null
)
{
throw
"device '
$deviceId
' not found"
;
throw
DaemonException
(
"device '
$deviceId
' not found"
)
;
}
final
String
applicationPackageId
=
_getStringArg
(
args
,
'applicationPackageId'
);
final
ApplicationPackage
applicationPackage
=
applicationPackageId
!=
null
?
_applicationPackages
[
applicationPackageId
]
:
null
;
...
...
@@ -979,7 +979,7 @@ class DeviceDomain extends Domain {
final
String
deviceId
=
_getStringArg
(
args
,
'deviceId'
,
required:
true
);
final
Device
device
=
await
daemon
.
deviceDomain
.
_getDevice
(
deviceId
);
if
(
device
==
null
)
{
throw
"device '
$deviceId
' not found"
;
throw
DaemonException
(
"device '
$deviceId
' not found"
)
;
}
final
String
applicationPackageId
=
_getStringArg
(
args
,
'applicationPackageId'
,
required:
true
);
final
ApplicationPackage
applicationPackage
=
_applicationPackages
[
applicationPackageId
];
...
...
@@ -1009,7 +1009,7 @@ class DeviceDomain extends Domain {
final
String
deviceId
=
_getStringArg
(
args
,
'deviceId'
,
required:
true
);
final
Device
device
=
await
daemon
.
deviceDomain
.
_getDevice
(
deviceId
);
if
(
device
==
null
)
{
throw
"device '
$deviceId
' not found"
;
throw
DaemonException
(
"device '
$deviceId
' not found"
)
;
}
final
String
applicationPackageId
=
_getStringArg
(
args
,
'applicationPackageId'
,
required:
true
);
final
ApplicationPackage
applicationPackage
=
_applicationPackages
[
applicationPackageId
];
...
...
@@ -1024,7 +1024,7 @@ class DeviceDomain extends Domain {
final
String
deviceId
=
_getStringArg
(
args
,
'deviceId'
,
required:
true
);
final
Device
device
=
await
daemon
.
deviceDomain
.
_getDevice
(
deviceId
);
if
(
device
==
null
)
{
throw
"device '
$deviceId
' not found"
;
throw
DaemonException
(
"device '
$deviceId
' not found"
)
;
}
final
String
tempFileName
=
'screenshot_
${_id++}
'
;
final
File
tempFile
=
daemon
.
proxyDomain
.
tempDirectory
.
childFile
(
tempFileName
);
...
...
@@ -1298,9 +1298,9 @@ class EmulatorDomain extends Domain {
final
List
<
Emulator
>
matches
=
await
emulators
.
getEmulatorsMatching
(
emulatorId
);
if
(
matches
.
isEmpty
)
{
throw
"emulator '
$emulatorId
' not found"
;
throw
DaemonException
(
"emulator '
$emulatorId
' not found"
)
;
}
else
if
(
matches
.
length
>
1
)
{
throw
"multiple emulators match '
$emulatorId
'"
;
throw
DaemonException
(
"multiple emulators match '
$emulatorId
'"
)
;
}
else
{
await
matches
.
first
.
launch
(
coldBoot:
coldBoot
);
}
...
...
@@ -1556,3 +1556,13 @@ class DebounceOperationQueue<T, K> {
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 {
bool
needsUpdate
=
false
;
globals
.
printStatus
(
'Verifying pubspecs...'
);
for
(
final
Directory
directory
in
packages
)
{
PubspecYaml
pubspec
;
try
{
pubspec
=
PubspecYaml
(
directory
);
}
on
String
catch
(
message
)
{
throwToolExit
(
message
);
}
final
PubspecYaml
pubspec
=
PubspecYaml
(
directory
);
globals
.
printTrace
(
'Reading pubspec.yaml from
${directory.path}
'
);
if
(
pubspec
.
checksum
.
value
==
null
)
{
// If the checksum is invalid or missing, we can just ask them run to run
...
...
@@ -310,12 +305,7 @@ class UpdatePackagesCommand extends FlutterCommand {
if
(
doUpgrade
)
{
globals
.
printTrace
(
'Reading pubspec.yaml from:
${directory.path}
'
);
}
PubspecYaml
pubspec
;
try
{
pubspec
=
PubspecYaml
(
directory
);
// this parses the pubspec.yaml
}
on
String
catch
(
message
)
{
throwToolExit
(
message
);
}
final
PubspecYaml
pubspec
=
PubspecYaml
(
directory
);
// this parses the pubspec.yaml
pubspecs
.
add
(
pubspec
);
// remember it for later
for
(
final
PubspecDependency
dependency
in
pubspec
.
allDependencies
)
{
if
(
allDependencies
.
containsKey
(
dependency
.
name
))
{
...
...
@@ -721,19 +711,19 @@ class PubspecYaml {
// 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.
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
)
{
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 '
'dev_dependencies section.'
;
'dev_dependencies section.'
)
;
}
seenMain
=
true
;
}
else
if
(
section
==
Section
.
devDependencies
)
{
// Similarly, if we're entering the dev_dependencies section, we should verify
// that we've not seen one already.
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
;
}
...
...
@@ -774,7 +764,7 @@ class PubspecYaml {
// First, make sure it's a unique dependency. Listing dependencies
// twice doesn't make sense.
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
;
}
else
{
...
...
@@ -1306,7 +1296,7 @@ class PubspecDependency extends PubspecLine {
_kind
=
DependencyKind
.
git
;
return
false
;
}
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
;
_lockLine
=
line
;
...
...
packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
View file @
d7688ca0
...
...
@@ -536,16 +536,16 @@ class FuchsiaDevice extends Device {
@override
Future
<
void
>
takeScreenshot
(
File
outputFile
)
async
{
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'
);
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
{
final
RunResult
scpResult
=
await
scp
(
'/tmp/screenshot.ppm'
,
outputFile
.
path
);
if
(
scpResult
.
exitCode
!=
0
)
{
throw
'Failed to copy screenshot from device:
\n
$scpResult
'
;
throw
Exception
(
'Failed to copy screenshot from device:
\n
$scpResult
'
)
;
}
}
finally
{
try
{
...
...
packages/flutter_tools/lib/src/localizations/localizations_utils.dart
View file @
d7688ca0
...
...
@@ -156,7 +156,7 @@ Map<String, List<String>> _parseSection(String section) {
}
final
int
colon
=
line
.
indexOf
(
':'
);
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
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 {
_ProxiedPortForwarder
get
proxiedPortForwarder
=>
_proxiedPortForwarder
??=
_ProxiedPortForwarder
(
connection
,
logger:
_logger
);
@override
DevicePortForwarder
get
portForwarder
=>
throw
UnimplementedError
;
DevicePortForwarder
get
portForwarder
=>
throw
UnimplementedError
()
;
@override
void
clearLogs
()
=>
throw
UnimplementedError
();
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
d7688ca0
...
...
@@ -633,7 +633,7 @@ abstract class ResidentHandlers {
/// the value of [fullRestart].
Future
<
OperationResult
>
restart
({
bool
fullRestart
=
false
,
bool
pause
=
false
,
String
reason
})
{
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.
...
...
@@ -1280,7 +1280,7 @@ abstract class ResidentRunner extends ResidentHandlers {
@required
bool
allowExistingDdsInstance
,
})
async
{
if
(!
debuggingOptions
.
debuggingEnabled
)
{
throw
'The service protocol is not enabled.'
;
throw
Exception
(
'The service protocol is not enabled.'
)
;
}
_finished
=
Completer
<
int
>();
// 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 {
if
(
debuggingEnabled
)
{
try
{
await
connectToServiceProtocol
(
allowExistingDdsInstance:
false
);
}
on
String
catch
(
message
)
{
globals
.
printError
(
message
);
}
on
Exception
catch
(
exception
)
{
globals
.
printError
(
exception
.
toString
()
);
appFailedToStart
();
return
2
;
}
...
...
packages/flutter_tools/lib/src/run_hot.dart
View file @
d7688ca0
...
...
@@ -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].
...
...
packages/flutter_tools/lib/src/test/flutter_platform.dart
View file @
d7688ca0
...
...
@@ -388,7 +388,7 @@ class FlutterPlatform extends PlatformPlugin {
bool
isStatic
,
)
async
{
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
=
await
compiler
.
compiler
.
compileExpression
(
expression
,
definitions
,
...
...
@@ -396,7 +396,7 @@ class FlutterPlatform extends PlatformPlugin {
if
(
compilerOutput
!=
null
&&
compilerOutput
.
expressionData
!=
null
)
{
return
base64
.
encode
(
compilerOutput
.
expressionData
);
}
throw
'Failed to compile
$expression
'
;
throw
Exception
(
'Failed to compile
$expression
'
)
;
}
TestDevice
_createTestDevice
(
int
ourTestCount
)
{
...
...
packages/flutter_tools/test/commands.shard/hermetic/daemon_test.dart
View file @
d7688ca0
...
...
@@ -660,7 +660,7 @@ void main() {
bool
isRunning
=
false
;
Future
<
int
>
f
(
int
ret
)
async
{
if
(
isRunning
)
{
throw
'Functions ran concurrently!'
;
throw
Exception
(
'Functions ran concurrently!'
)
;
}
isRunning
=
true
;
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() {
'[☠] 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, '
'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
'
'[✓] Four score and seven validators ago (with statusInfo)
\n
'
'
\n
'
...
...
@@ -378,7 +378,7 @@ void main() {
'[☠] 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, '
'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
'
'[✓] Four score and seven validators ago (with statusInfo)
\n
'
'
\n
'
...
...
@@ -848,7 +848,7 @@ class CrashingValidator extends DoctorValidator {
@override
Future
<
ValidationResult
>
validate
()
async
{
throw
'fatal error'
;
throw
StateError
(
'fatal error'
)
;
}
}
...
...
@@ -862,7 +862,7 @@ class AsyncCrashingValidator extends DoctorValidator {
const
Duration
delay
=
Duration
(
seconds:
1
);
final
Future
<
ValidationResult
>
result
=
Future
<
ValidationResult
>.
delayed
(
delay
)
.
then
((
_
)
{
throw
'fatal error'
;
throw
StateError
(
'fatal error'
)
;
});
_time
.
elapse
(
const
Duration
(
seconds:
1
));
_time
.
flushMicrotasks
();
...
...
packages/flutter_tools/test/general.shard/android/android_device_test.dart
View file @
d7688ca0
...
...
@@ -260,7 +260,7 @@ flutter:
]),
androidConsoleSocketFactory:
(
String
host
,
int
port
)
async
{
socketWasCreated
=
true
;
throw
'Socket was created for non-emulator'
;
throw
Exception
(
'Socket was created for non-emulator'
)
;
}
);
...
...
@@ -279,7 +279,7 @@ flutter:
]),
androidConsoleSocketFactory:
(
String
host
,
int
port
)
async
{
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 {
// as part of the previous text to ensure both are handled.
_controller
.
add
(
'OK
\n
'
);
}
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';
Future
<
void
>
asyncError
()
{
final
Completer
<
void
>
completer
=
Completer
<
void
>();
final
Completer
<
void
>
errorCompleter
=
Completer
<
void
>();
errorCompleter
.
completeError
(
'Async Doom'
,
StackTrace
.
current
);
errorCompleter
.
completeError
(
_CustomException
(
'Async Doom'
)
,
StackTrace
.
current
);
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
()
{
throw
'Sync Doom'
;
throw
_CustomException
(
'Sync Doom'
)
;
}
Future
<
void
>
syncAndAsyncError
()
{
final
Completer
<
void
>
errorCompleter
=
Completer
<
void
>();
errorCompleter
.
completeError
(
'Async Doom'
,
StackTrace
.
current
);
throw
'Sync Doom'
;
errorCompleter
.
completeError
(
_CustomException
(
'Async Doom'
)
,
StackTrace
.
current
);
throw
_CustomException
(
'Sync Doom'
)
;
}
Future
<
void
>
delayedThrow
(
FakeAsync
time
)
{
final
Future
<
void
>
result
=
Future
<
void
>.
delayed
(
const
Duration
(
milliseconds:
10
))
.
then
((
_
)
async
{
throw
'Delayed Doom'
;
throw
_CustomException
(
'Delayed Doom'
)
;
});
time
.
elapse
(
const
Duration
(
seconds:
1
));
time
.
flushMicrotasks
();
...
...
@@ -69,7 +80,7 @@ void main() {
try
{
// Completer is required or else we timeout.
await
Future
.
any
(<
Future
<
void
>>[
asyncError
(),
caughtInZone
.
future
]);
}
on
String
{
}
on
_CustomException
{
caughtByHandler
=
true
;
}
});
...
...
@@ -83,7 +94,7 @@ void main() {
try
{
// Completer is required or else we timeout.
await
Future
.
any
(<
Future
<
void
>>[
syncAndAsyncError
(),
caughtInZone
.
future
]);
}
on
String
{
}
on
_CustomException
{
caughtByHandler
=
true
;
}
});
...
...
@@ -96,7 +107,7 @@ void main() {
await
zone
.
run
(()
async
{
try
{
await
syncError
();
}
on
String
{
}
on
_CustomException
{
caughtByHandler
=
true
;
}
});
...
...
@@ -109,7 +120,7 @@ void main() {
await
zone
.
run
(()
async
{
try
{
await
asyncGuard
(
syncError
);
}
on
String
{
}
on
_CustomException
{
caughtByHandler
=
true
;
}
});
...
...
@@ -123,7 +134,7 @@ void main() {
await
zone
.
run
(()
async
{
try
{
await
asyncGuard
(
asyncError
);
}
on
String
{
}
on
_CustomException
{
caughtByHandler
=
true
;
}
});
...
...
@@ -136,7 +147,7 @@ void main() {
await
zone
.
run
(()
async
{
try
{
await
asyncGuard
(
syncAndAsyncError
);
}
on
String
{
}
on
_CustomException
{
caughtByHandler
=
true
;
}
});
...
...
@@ -159,7 +170,7 @@ void main() {
});
try
{
await
f
;
}
on
String
{
}
on
_CustomException
{
caughtByHandler
=
true
;
}
if
(!
completer
.
isCompleted
)
{
...
...
@@ -197,7 +208,7 @@ void main() {
);
try
{
await
f
;
}
on
String
{
}
on
_CustomException
{
caughtByHandler
=
true
;
}
if
(!
completer
.
isCompleted
)
{
...
...
@@ -235,7 +246,7 @@ void main() {
);
try
{
await
f
;
}
on
String
{
}
on
_CustomException
{
caughtByHandler
=
true
;
}
if
(!
completer
.
isCompleted
)
{
...
...
@@ -275,7 +286,7 @@ void main() {
);
try
{
await
f
;
}
on
String
{
}
on
_CustomException
{
caughtByHandler
=
true
;
}
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 {
}
class
FakeExistsFile
extends
Fake
implements
File
{
late
Object
error
;
late
Exception
error
;
int
existsCount
=
0
;
...
...
packages/flutter_tools/test/general.shard/base/logger_test.dart
View file @
d7688ca0
...
...
@@ -1267,7 +1267,7 @@ void main() {
/// A fake [Logger] that throws the [Invocation] for any method call.
class
FakeLogger
implements
Logger
{
@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].
...
...
@@ -1309,14 +1309,14 @@ class FakeStdout extends Fake implements Stdout {
@override
void
write
(
Object
object
)
{
if
(
syncError
)
{
throw
'Error!'
;
throw
Exception
(
'Error!'
)
;
}
Zone
.
current
.
runUnaryGuarded
<
void
>((
_
)
{
if
(
completeWithError
)
{
_completer
.
completeError
(
Exception
(
'Some pipe error'
));
}
else
{
_completer
.
complete
();
throw
'Error!'
;
throw
Exception
(
'Error!'
)
;
}
},
null
);
}
...
...
packages/flutter_tools/test/general.shard/crash_reporting_test.dart
View file @
d7688ca0
...
...
@@ -381,7 +381,7 @@ class MockCrashReportSender extends MockClient {
}
class
CrashingCrashReportSender
extends
MockClient
{
CrashingCrashReportSender
(
Object
exception
)
:
super
((
Request
request
)
async
{
CrashingCrashReportSender
(
Exception
exception
)
:
super
((
Request
request
)
async
{
throw
exception
;
});
}
...
...
packages/flutter_tools/test/general.shard/devfs_test.dart
View file @
d7688ca0
...
...
@@ -519,7 +519,7 @@ void main() {
}
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
'
);
}
else
{
throw
'Saw
$data
(
$stringData
)'
;
throw
Exception
(
'Saw
$data
(
$stringData
)'
)
;
}
processed
++;
}
...
...
packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart
View file @
d7688ca0
...
...
@@ -440,7 +440,11 @@ void main() {
final
FuchsiaDevice
device
=
FuchsiaDevice
(
'id'
,
name:
'tester'
);
await
expectLater
(
()
=>
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() {
await
expectLater
(
()
=>
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
>{
ProcessManager:
()
=>
processManager
,
...
...
@@ -506,7 +514,11 @@ void main() {
await
expectLater
(
()
=>
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
>{
ProcessManager:
()
=>
processManager
,
...
...
packages/flutter_tools/test/general.shard/hot_test.dart
View file @
d7688ca0
...
...
@@ -465,7 +465,7 @@ void main() {
final
List
<
FlutterDevice
>
devices
=
<
FlutterDevice
>[
fakeFlutterDevice
,
];
fakeFlutterDevice
.
updateDevFSReportCallback
=
()
async
=>
throw
'updateDevFS failed'
;
fakeFlutterDevice
.
updateDevFSReportCallback
=
()
async
=>
throw
Exception
(
'updateDevFS failed'
)
;
final
HotRunner
runner
=
HotRunner
(
devices
,
...
...
@@ -474,7 +474,7 @@ void main() {
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
);
},
overrides:
<
Type
,
Generator
>{
HotRunnerConfig:
()
=>
testingConfig
,
...
...
@@ -499,7 +499,7 @@ void main() {
final
List
<
FlutterDevice
>
devices
=
<
FlutterDevice
>[
fakeFlutterDevice
,
];
fakeFlutterDevice
.
updateDevFSReportCallback
=
()
async
=>
throw
'updateDevFS failed'
;
fakeFlutterDevice
.
updateDevFSReportCallback
=
()
async
=>
throw
Exception
(
'updateDevFS failed'
)
;
final
HotRunner
runner
=
HotRunner
(
devices
,
...
...
@@ -508,7 +508,7 @@ void main() {
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
);
},
overrides:
<
Type
,
Generator
>{
HotRunnerConfig:
()
=>
testingConfig
,
...
...
packages/flutter_tools/test/general.shard/project_test.dart
View file @
d7688ca0
...
...
@@ -925,7 +925,7 @@ void transfer(FileSystemEntity entity, FileSystem target) {
}
else
if
(
entity
is
File
)
{
target
.
file
(
entity
.
absolute
.
path
).
writeAsBytesSync
(
entity
.
readAsBytesSync
(),
flush:
true
);
}
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 {
}
@override
List
<
ForwardedPort
>
get
forwardedPorts
=>
throw
'not implemented'
;
List
<
ForwardedPort
>
get
forwardedPorts
=>
throw
UnimplementedError
()
;
@override
Future
<
void
>
unforward
(
ForwardedPort
forwardedPort
)
{
throw
'not implemented'
;
throw
UnimplementedError
()
;
}
@override
...
...
packages/flutter_tools/test/general.shard/resident_runner_test.dart
View file @
d7688ca0
...
...
@@ -2142,8 +2142,8 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
success:
true
,
invalidatedSourcesCount:
1
,
);
Object
reportError
;
Object
runColdError
;
Exception
reportError
;
Exception
runColdError
;
int
runHotCode
=
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 {
@override
Future
<
ConnectionResult
>
connect
(
bool
useDebugExtension
)
async
{
if
(
exception
!=
null
)
{
assert
(
exception
is
Exception
||
exception
is
Error
);
// ignore: only_throw_errors, exception is either Error or Exception here.
throw
exception
;
}
return
result
;
...
...
@@ -1299,7 +1301,7 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
success:
true
,
invalidatedSourcesCount:
1
,
);
Object
reportError
;
Exception
reportError
;
@override
ResidentCompiler
generator
;
...
...
packages/flutter_tools/test/general.shard/runner/runner_test.dart
View file @
d7688ca0
...
...
@@ -44,7 +44,7 @@ void main() {
// TODO(jamesderlin): Ideally only the first call to exit() would be
// honored and subsequent calls would be no-ops, but existing tests
// rely on all calls to throw.
throw
'test exit'
;
throw
Exception
(
'test exit'
)
;
});
Cache
.
disableLocking
();
...
...
@@ -75,7 +75,7 @@ void main() {
onError:
(
Object
error
,
StackTrace
stack
)
{
// ignore: deprecated_member_use
expect
(
firstExitCode
,
isNotNull
);
expect
(
firstExitCode
,
isNot
(
0
));
expect
(
error
,
'
test exit'
);
expect
(
error
.
toString
(),
'Exception:
test exit'
);
completer
.
complete
();
},
));
...
...
@@ -88,7 +88,7 @@ void main() {
// *original* crash, and not the crash from the first crash report
// attempt.
final
CrashingUsage
crashingUsage
=
globals
.
flutterUsage
as
CrashingUsage
;
expect
(
crashingUsage
.
sentException
,
'
an exception % --'
);
expect
(
crashingUsage
.
sentException
.
toString
(),
'Exception:
an exception % --'
);
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
FakePlatform
(
environment:
<
String
,
String
>{
'FLUTTER_ANALYTICS_LOG_FILE'
:
'test'
,
...
...
@@ -127,7 +127,7 @@ void main() {
onError:
(
Object
error
,
StackTrace
stack
)
{
// ignore: deprecated_member_use
expect
(
firstExitCode
,
isNotNull
);
expect
(
firstExitCode
,
isNot
(
0
));
expect
(
error
,
'
test exit'
);
expect
(
error
.
toString
(),
'Exception:
test exit'
);
completer
.
complete
();
},
));
...
...
@@ -174,7 +174,7 @@ void main() {
onError:
(
Object
error
,
StackTrace
stack
)
{
// ignore: deprecated_member_use
expect
(
firstExitCode
,
isNotNull
);
expect
(
firstExitCode
,
isNot
(
0
));
expect
(
error
,
'
test exit'
);
expect
(
error
.
toString
(),
'Exception:
test exit'
);
completer
.
complete
();
},
));
...
...
@@ -183,20 +183,20 @@ void main() {
final
String
errorText
=
testLogger
.
errorText
;
expect
(
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
String
logContents
=
log
.
readAsStringSync
();
expect
(
logContents
,
contains
(
kCustomBugInstructions
));
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
(
'[✓] Flutter'
));
final
CrashDetails
sentDetails
=
(
globals
.
crashReporter
as
WaitingCrashReporter
).
_details
;
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
(
await
sentDetails
.
doctorText
.
text
,
contains
(
'[✓] Flutter'
));
},
overrides:
<
Type
,
Generator
>{
...
...
@@ -234,7 +234,7 @@ class CrashingFlutterCommand extends FlutterCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
const
String
error
=
'an exception % --'
;
// Test URL encoding.
final
Exception
error
=
Exception
(
'an exception % --'
)
;
// Test URL encoding.
if
(!
_asyncCrash
)
{
throw
error
;
}
...
...
@@ -270,7 +270,7 @@ class CrashingUsage implements Usage {
void
sendException
(
dynamic
exception
)
{
if
(
_firstAttempt
)
{
_firstAttempt
=
false
;
throw
'CrashingUsage.sendException'
;
throw
Exception
(
'CrashingUsage.sendException'
)
;
}
_sentException
=
exception
;
}
...
...
packages/flutter_tools/test/integration.shard/debug_adapter/test_client.dart
View file @
d7688ca0
...
...
@@ -76,7 +76,7 @@ class DapTestClient {
/// Returns a Future that completes with the next [event] event.
Future
<
Event
>
event
(
String
event
)
=>
_eventController
.
stream
.
firstWhere
(
(
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.
Stream
<
Event
>
events
(
String
event
)
{
...
...
@@ -190,13 +190,13 @@ class DapTestClient {
/// event for [extension].
Future
<
Map
<
String
,
Object
?>>
serviceExtensionAdded
(
String
extension
)
=>
serviceExtensionAddedEvents
.
firstWhere
(
(
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
/// event for [extension].
Future
<
Map
<
String
,
Object
?>>
serviceExtensionStateChanged
(
String
extension
)
=>
serviceExtensionStateChangedEvents
.
firstWhere
(
(
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
/// 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 {
.
listen
((
String
error
)
{
logger
?.
call
(
error
);
if
(!
_isShuttingDown
)
{
throw
error
;
throw
Exception
(
error
)
;
}
});
unawaited
(
_process
.
exitCode
.
then
((
int
code
)
{
final
String
message
=
'Out-of-process DAP server terminated with code
$code
'
;
logger
?.
call
(
message
);
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() {
await
flutter
.
run
();
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 {
timeoutExpired
=
true
;
_debugPrint
(
messages
.
toString
());
}
throw
error
;
throw
error
;
// ignore: only_throw_errors
}).
whenComplete
(()
=>
subscription
.
cancel
());
}
}
...
...
@@ -753,7 +753,7 @@ class FlutterRunTestDriver extends FlutterTestDriver {
}
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
;
...
...
packages/flutter_tools/test/src/context.dart
View file @
d7688ca0
...
...
@@ -153,7 +153,7 @@ void testUsingContext(
print
(
error
);
// ignore: avoid_print
print
(
stackTrace
);
// ignore: avoid_print
_printBufferedErrors
(
context
);
throw
error
;
throw
error
;
//ignore: only_throw_errors
});
},
);
...
...
@@ -348,10 +348,10 @@ class LocalFileSystemBlockingSetCurrentDirectory extends LocalFileSystem {
@override
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. '
'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 {
_pid
+=
1
;
final
FakeCommand
fakeCommand
=
findCommand
(
command
,
workingDirectory
,
environment
,
encoding
);
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
)
{
fakeCommand
.
onRun
!();
...
...
packages/flutter_tools/test/src/test_build_system.dart
View file @
d7688ca0
...
...
@@ -27,7 +27,7 @@ class TestBuildSystem implements BuildSystem {
final
List
<
BuildResult
>
_results
;
final
BuildResult
?
_singleResult
;
final
Object
?
_exception
;
final
Exception
?
_exception
;
final
void
Function
(
Target
target
,
Environment
environment
)?
_onRun
;
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