refactor: improve MoveItemToTrash error description (#23629)

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
trop[bot]
2020-05-18 11:11:05 -04:00
committed by GitHub
parent 6b8ca86459
commit a8196fbc18

View File

@@ -135,13 +135,15 @@ bool MoveItemToTrash(const base::FilePath& full_path, bool delete_on_fail) {
// Handle this by deleting the item as a fallback.
if (!did_trash && [err code] == NSFeatureUnsupportedError) {
did_trash = [[NSFileManager defaultManager] removeItemAtURL:url
error:nil];
error:&err];
}
}
if (!did_trash)
if (!did_trash) {
LOG(WARNING) << "NSWorkspace failed to move file " << full_path.value()
<< " to trash";
<< " to trash: "
<< base::SysNSStringToUTF8([err localizedDescription]);
}
return did_trash;
}