From 33c6d3f12211d716768ab195be90d598cd2bd364 Mon Sep 17 00:00:00 2001 From: "ahendrickson@chromium.org" Date: Sun, 4 Sep 2011 00:00:54 +0000 Subject: Make BaseFile member functions return net::Error's. Moving towards giving the user feedback when a file system error occurs during a download. Split from CL 7134019. rdsmith: downloads phajdan.jr: downloads, base wtc: net brettw: base BUG=None TEST=None Review URL: http://codereview.chromium.org/7778003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99579 0039d316-1c4b-4281-b951-d872f2087c98 --- net/base/net_errors_posix.cc | 53 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) (limited to 'net/base/net_errors_posix.cc') diff --git a/net/base/net_errors_posix.cc b/net/base/net_errors_posix.cc index 31450f9..143912c 100644 --- a/net/base/net_errors_posix.cc +++ b/net/base/net_errors_posix.cc @@ -26,7 +26,7 @@ Error MapSystemError(int os_error) { case ETIMEDOUT: return ERR_TIMED_OUT; case ECONNRESET: - case ENETRESET: // Related to keep-alive + case ENETRESET: // Related to keep-alive. case EPIPE: return ERR_CONNECTION_RESET; case ECONNABORTED: @@ -48,6 +48,57 @@ Error MapSystemError(int os_error) { return ERR_INVALID_ARGUMENT; case EADDRINUSE: return ERR_ADDRESS_IN_USE; + case E2BIG: // Argument list too long. + return ERR_INVALID_ARGUMENT; + case EBADF: // Bad file descriptor. + return ERR_INVALID_HANDLE; + case EBUSY: // Device or resource busy. + return ERR_INSUFFICIENT_RESOURCES; + case ECANCELED: // Operation canceled. + return ERR_ABORTED; + case EDEADLK: // Resource deadlock avoided. + return ERR_INSUFFICIENT_RESOURCES; + case EDQUOT: // Disk quota exceeded. + return ERR_FILE_NO_SPACE; + case EEXIST: // File exists. + return ERR_FILE_EXISTS; + case EFAULT: // Bad address. + return ERR_INVALID_ARGUMENT; + case EFBIG: // File too large. + return ERR_FILE_TOO_BIG; + case EISDIR: // Is a directory. + return ERR_FILE_NOT_FOUND; + case ENAMETOOLONG: // Filename too long. + return ERR_FILE_PATH_TOO_LONG; + case ENFILE: // Too many open files in system. + return ERR_INSUFFICIENT_RESOURCES; + case ENOBUFS: // No buffer space available. + return ERR_OUT_OF_MEMORY; + case ENODEV: // No such device. + return ERR_INVALID_ARGUMENT; + case ENOENT: // No such file or directory. + return ERR_FILE_NOT_FOUND; + case ENOLCK: // No locks available. + return ERR_INSUFFICIENT_RESOURCES; + case ENOMEM: // Not enough space. + return ERR_OUT_OF_MEMORY; + case ENOSPC: // No space left on device. + return ERR_FILE_NO_SPACE; + case ENOSYS: // Function not implemented. + return ERR_NOT_IMPLEMENTED; + case ENOTDIR: // Not a directory. + return ERR_FILE_NOT_FOUND; + case ENOTSUP: // Operation not supported. + return ERR_NOT_IMPLEMENTED; + case EPERM: // Operation not permitted. + return ERR_ACCESS_DENIED; + case EROFS: // Read-only file system. + return ERR_ACCESS_DENIED; + case ETXTBSY: // Text file busy. + return ERR_ACCESS_DENIED; + case EUSERS: // Too many users. + return ERR_INSUFFICIENT_RESOURCES; + case 0: return OK; default: -- cgit v1.1