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
abb48f49
Unverified
Commit
abb48f49
authored
Jan 13, 2021
by
Jonah Williams
Committed by
GitHub
Jan 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] add error handling wrapping for File.createSync (#73890)
parent
1eb0bb52
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
error_handling_io.dart
packages/flutter_tools/lib/src/base/error_handling_io.dart
+11
-0
error_handling_io_test.dart
...tools/test/general.shard/base/error_handling_io_test.dart
+8
-0
No files found.
packages/flutter_tools/lib/src/base/error_handling_io.dart
View file @
abb48f49
...
...
@@ -263,6 +263,17 @@ class ErrorHandlingFile
);
}
@override
void
createSync
({
bool
recursive
=
false
})
{
_runSync
<
void
>(
()
=>
delegate
.
createSync
(
recursive:
recursive
,
),
platform:
_platform
,
failureMessage:
'Flutter failed to create file at "
${delegate.path}
"'
,
);
}
@override
RandomAccessFile
openSync
({
FileMode
mode
=
FileMode
.
read
})
{
return
_runSync
<
RandomAccessFile
>(
...
...
packages/flutter_tools/test/general.shard/base/error_handling_io_test.dart
View file @
abb48f49
...
...
@@ -76,6 +76,8 @@ void setupWriteMocks({
when
(
mockFile
.
openSync
(
mode:
anyNamed
(
'mode'
),
)).
thenThrow
(
FileSystemException
(
''
,
''
,
OSError
(
''
,
errorCode
)));
when
(
mockFile
.
createSync
(
recursive:
anyNamed
(
'recursive'
)))
.
thenThrow
(
FileSystemException
(
''
,
''
,
OSError
(
''
,
errorCode
)));
}
void
setupReadMocks
(
{
...
...
@@ -230,6 +232,8 @@ void main() {
throwsToolExit
(
message:
expectedMessage
));
expect
(()
=>
file
.
openSync
(),
throwsToolExit
(
message:
expectedMessage
));
expect
(()
=>
file
.
createSync
(),
throwsToolExit
(
message:
expectedMessage
));
});
testWithoutContext
(
'when writing to a full device'
,
()
async
{
...
...
@@ -293,6 +297,8 @@ void main() {
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
{
...
...
@@ -390,6 +396,8 @@ void main() {
throwsToolExit
(
message:
expectedMessage
));
expect
(()
=>
file
.
openSync
(),
throwsToolExit
(
message:
expectedMessage
));
expect
(()
=>
file
.
createSync
(),
throwsToolExit
(
message:
expectedMessage
));
});
testWithoutContext
(
'when access is denied for directories'
,
()
async
{
...
...
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