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
738a7747
Unverified
Commit
738a7747
authored
Oct 01, 2021
by
Christopher Fujino
Committed by
GitHub
Oct 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Handle disk device not found (#90996)
parent
d94c18d2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
+46
-0
error_handling_io.dart
packages/flutter_tools/lib/src/base/error_handling_io.dart
+7
-0
error_handling_io_test.dart
...tools/test/general.shard/base/error_handling_io_test.dart
+39
-0
No files found.
packages/flutter_tools/lib/src/base/error_handling_io.dart
View file @
738a7747
...
...
@@ -768,6 +768,7 @@ void _handleWindowsException(Exception e, String? message, int errorCode) {
const
int
kUserMappedSectionOpened
=
1224
;
const
int
kAccessDenied
=
5
;
const
int
kFatalDeviceHardwareError
=
483
;
const
int
kDeviceDoesNotExist
=
433
;
// Catch errors and bail when:
String
?
errorMessage
;
...
...
@@ -796,6 +797,12 @@ void _handleWindowsException(Exception e, String? message, int errorCode) {
'
$message
. There is a problem with the device driver '
'that this file or directory is stored on.'
;
break
;
case
kDeviceDoesNotExist:
errorMessage
=
'
$message
. The device was not found.'
'
\n
$e
\n
'
'Verify the device is mounted and try again.'
;
break
;
default
:
// Caller must rethrow the exception.
break
;
...
...
packages/flutter_tools/test/general.shard/base/error_handling_io_test.dart
View file @
738a7747
...
...
@@ -100,6 +100,7 @@ void main() {
const
int
kUserMappedSectionOpened
=
1224
;
const
int
kUserPermissionDenied
=
5
;
const
int
kFatalDeviceHardwareError
=
483
;
const
int
kDeviceDoesNotExist
=
433
;
late
FileExceptionHandler
exceptionHandler
;
...
...
@@ -260,6 +261,44 @@ void main() {
throwsToolExit
(
message:
expectedMessage
));
});
testWithoutContext
(
'when the device does not exist'
,
()
async
{
final
ErrorHandlingFileSystem
fileSystem
=
ErrorHandlingFileSystem
(
delegate:
MemoryFileSystem
.
test
(
opHandle:
exceptionHandler
.
opHandle
),
platform:
windowsPlatform
,
);
final
File
file
=
fileSystem
.
file
(
'file'
);
exceptionHandler
.
addError
(
file
,
FileSystemOp
.
write
,
FileSystemException
(
''
,
file
.
path
,
const
OSError
(
''
,
kDeviceDoesNotExist
)),
);
exceptionHandler
.
addError
(
file
,
FileSystemOp
.
open
,
FileSystemException
(
''
,
file
.
path
,
const
OSError
(
''
,
kDeviceDoesNotExist
)),
);
exceptionHandler
.
addError
(
file
,
FileSystemOp
.
create
,
FileSystemException
(
''
,
file
.
path
,
const
OSError
(
''
,
kDeviceDoesNotExist
)),
);
const
String
expectedMessage
=
'The device was not found.'
;
expect
(()
async
=>
file
.
writeAsBytes
(<
int
>[
0
]),
throwsToolExit
(
message:
expectedMessage
));
expect
(()
async
=>
file
.
writeAsString
(
''
),
throwsToolExit
(
message:
expectedMessage
));
expect
(()
=>
file
.
writeAsBytesSync
(<
int
>[
0
]),
throwsToolExit
(
message:
expectedMessage
));
expect
(()
=>
file
.
writeAsStringSync
(
''
),
throwsToolExit
(
message:
expectedMessage
));
expect
(()
=>
file
.
openSync
(),
throwsToolExit
(
message:
expectedMessage
));
expect
(()
=>
file
.
createSync
(),
throwsToolExit
(
message:
expectedMessage
));
});
testWithoutContext
(
'when creating a temporary dir on a full device'
,
()
async
{
final
ErrorHandlingFileSystem
fileSystem
=
ErrorHandlingFileSystem
(
delegate:
MemoryFileSystem
.
test
(
opHandle:
exceptionHandler
.
opHandle
),
...
...
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