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

Unified Diff: runtime/bin/directory.cc

Issue 17158003: Report async errors when they happend, in directory listing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 | « no previous file | runtime/bin/directory_macos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/directory.cc
diff --git a/runtime/bin/directory.cc b/runtime/bin/directory.cc
index 6dd4406aa0be5368c30d050bb0cceb884f789586..7ce178751bf15fe85d3c4425ce521734414efa02 100644
--- a/runtime/bin/directory.cc
+++ b/runtime/bin/directory.cc
@@ -242,6 +242,17 @@ static CObject* DirectoryListStartRequest(const CObjectArray& request) {
new AsyncDirectoryListing(path.CString(),
recursive.Value(),
follow_links.Value());
+ if (dir_listing->error()) {
+ // Report error now, so we capture the correct OSError.
+ CObject* err = CObject::NewOSError();
+ delete dir_listing;
+ CObjectArray* error = new CObjectArray(CObject::NewArray(3));
+ error->SetAt(0, new CObjectInt32(
+ CObject::NewInt32(AsyncDirectoryListing::kListError)));
+ error->SetAt(1, request[1]);
+ error->SetAt(2, err);
+ return error;
+ }
// TODO(ajohnsen): Consider returning the first few results.
return new CObjectIntptr(CObject::NewIntptr(
reinterpret_cast<intptr_t>(dir_listing)));
@@ -389,8 +400,8 @@ void AsyncDirectoryListing::HandleDone() {
bool AsyncDirectoryListing::HandleError(const char* dir_name) {
- array_->SetAt(index_++, new CObjectInt32(CObject::NewInt32(kListError)));
CObject* err = CObject::NewOSError();
+ array_->SetAt(index_++, new CObjectInt32(CObject::NewInt32(kListError)));
CObjectArray* response = new CObjectArray(CObject::NewArray(3));
response->SetAt(0, new CObjectInt32(CObject::NewInt32(kListError)));
response->SetAt(1, new CObjectString(CObject::NewString(dir_name)));
« no previous file with comments | « no previous file | runtime/bin/directory_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698