Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: runtime/bin/file_impl.dart

Issue 9773018: Add error handling to directory (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/directory_win.cc ('k') | tests/standalone/src/io/DirectoryErrorTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_impl.dart
diff --git a/runtime/bin/file_impl.dart b/runtime/bin/file_impl.dart
index 45196cf769c2e687d671442fb347b099307beb29..83a4e83e484c6d3dd738e707d18c28be184fa697 100644
--- a/runtime/bin/file_impl.dart
+++ b/runtime/bin/file_impl.dart
@@ -229,6 +229,10 @@ class _FileUtils {
static final kOSErrorResponse = 2;
static final kFileClosedResponse = 3;
+ static final kErrorResponseErrorType = 0;
+ static final kOSErrorResponseErrorCode = 1;
+ static final kOSErrorResponseMessage = 2;
+
static List ensureFastAndSerializableBuffer(
List buffer, int offset, int bytes) {
// When using the Dart C API to access raw data, using a ByteArray is
@@ -373,13 +377,14 @@ class _FileBase {
bool _reportError(response, String message) {
assert(_isErrorResponse(response));
if (_onError != null) {
- switch (response[0]) {
+ switch (response[_FileUtil.kErrorResponseErrorType]) {
case _FileUtils.kIllegalArgumentResponse:
_onError(new IllegalArgumentException());
break;
case _FileUtils.kOSErrorResponse:
- _onError(new FileIOException(message,
- new OSError(response[2], response[1])));
+ var err = new OSError(response[_FileUtils.kOSErrorResponseErrorCode],
+ response[_FileUtils.kOSErrorResponseMessage]);
+ _onError(new FileIOException(message, err));
break;
case _FileUtils.kFileClosedResponse:
_onError(new FileIOException("File closed"));
« no previous file with comments | « runtime/bin/directory_win.cc ('k') | tests/standalone/src/io/DirectoryErrorTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698