Better error messages.
GitOrigin-RevId: 70b1cea8a4ba9fa42074b5bc7bd7d339ae1c1779
This commit is contained in:
parent
505316d9f9
commit
09c4422c50
@ -212,7 +212,7 @@ Result<size_t> FileFd::write(Slice slice) {
|
||||
if (success) {
|
||||
return narrow_cast<size_t>(bytes_written);
|
||||
}
|
||||
return OS_ERROR(PSLICE() << "Write to [fd = " << native_fd << "] has failed");
|
||||
return OS_ERROR(PSLICE() << "Write to " << get_native_fd() << " has failed");
|
||||
}
|
||||
|
||||
Result<size_t> FileFd::read(MutableSlice slice) {
|
||||
@ -232,7 +232,7 @@ Result<size_t> FileFd::read(MutableSlice slice) {
|
||||
}
|
||||
return static_cast<size_t>(bytes_read);
|
||||
}
|
||||
return OS_ERROR(PSLICE() << "Read from [fd = " << native_fd << "] has failed");
|
||||
return OS_ERROR(PSLICE() << "Read from " << get_native_fd() << " has failed");
|
||||
}
|
||||
|
||||
Result<size_t> FileFd::pwrite(Slice slice, int64 offset) {
|
||||
@ -256,7 +256,7 @@ Result<size_t> FileFd::pwrite(Slice slice, int64 offset) {
|
||||
if (success) {
|
||||
return narrow_cast<size_t>(bytes_written);
|
||||
}
|
||||
return OS_ERROR(PSLICE() << "Pwrite to [fd = " << native_fd << "] at [offset = " << offset << "] has failed");
|
||||
return OS_ERROR(PSLICE() << "Pwrite to " << get_native_fd() << " at offset " << offset << " has failed");
|
||||
}
|
||||
|
||||
Result<size_t> FileFd::pread(MutableSlice slice, int64 offset) const {
|
||||
@ -279,7 +279,7 @@ Result<size_t> FileFd::pread(MutableSlice slice, int64 offset) const {
|
||||
if (success) {
|
||||
return narrow_cast<size_t>(bytes_read);
|
||||
}
|
||||
return OS_ERROR(PSLICE() << "Pread from [fd = " << native_fd << "] at [offset = " << offset << "] has failed");
|
||||
return OS_ERROR(PSLICE() << "Pread from " << get_native_fd() << " at offset " << offset << " has failed");
|
||||
}
|
||||
|
||||
Status FileFd::lock(FileFd::LockFlags flags, int32 max_tries) {
|
||||
|
@ -229,7 +229,7 @@ class ServerSocketFdImpl {
|
||||
return Status::Error(-1, "Operation would block");
|
||||
}
|
||||
|
||||
auto error = Status::PosixError(accept_errno, PSLICE() << "Accept from [fd = " << native_fd << "] has failed");
|
||||
auto error = Status::PosixError(accept_errno, PSLICE() << "Accept from " << get_native_fd() << " has failed");
|
||||
switch (accept_errno) {
|
||||
case EBADF:
|
||||
case EFAULT:
|
||||
|
@ -361,7 +361,7 @@ class SocketFdImpl {
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto error = Status::PosixError(write_errno, PSLICE() << "Write to fd " << native_fd << " has failed");
|
||||
auto error = Status::PosixError(write_errno, PSLICE() << "Write to " << get_native_fd() << " has failed");
|
||||
switch (write_errno) {
|
||||
case EBADF:
|
||||
case ENXIO:
|
||||
@ -409,7 +409,7 @@ class SocketFdImpl {
|
||||
get_poll_info().clear_flags(PollFlags::Read());
|
||||
return 0;
|
||||
}
|
||||
auto error = Status::PosixError(read_errno, PSLICE() << "Read from fd " << native_fd << " has failed");
|
||||
auto error = Status::PosixError(read_errno, PSLICE() << "Read from " << get_native_fd() << " has failed");
|
||||
switch (read_errno) {
|
||||
case EISDIR:
|
||||
case EBADF:
|
||||
@ -453,9 +453,9 @@ Status get_socket_pending_error(const NativeFd &fd) {
|
||||
if (error == 0) {
|
||||
return Status::OK();
|
||||
}
|
||||
return Status::PosixError(error, PSLICE() << "Error on socket [fd_ = " << fd << "]");
|
||||
return Status::PosixError(error, PSLICE() << "Error on socket " << fd);
|
||||
}
|
||||
auto status = OS_SOCKET_ERROR(PSLICE() << "Can't load error on socket [fd_ = " << fd << "]");
|
||||
auto status = OS_SOCKET_ERROR(PSLICE() << "Can't load error on socket " << fd);
|
||||
LOG(INFO) << "Can't load pending socket error: " << status;
|
||||
return status;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ Stat fstat(int native_fd) {
|
||||
struct ::stat buf;
|
||||
int err = fstat(native_fd, &buf);
|
||||
auto fstat_errno = errno;
|
||||
LOG_IF(FATAL, err < 0) << Status::PosixError(fstat_errno, PSLICE() << "stat for fd " << native_fd << " failed");
|
||||
LOG_IF(FATAL, err < 0) << Status::PosixError(fstat_errno, PSLICE() << "Stat for fd " << native_fd << " failed");
|
||||
return detail::from_native_stat(buf);
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ class BufferedStdinImpl {
|
||||
if (res) {
|
||||
return static_cast<size_t>(bytes_read);
|
||||
}
|
||||
return OS_ERROR(PSLICE() << "Read from [fd = " << native_fd << "] has failed");
|
||||
return OS_ERROR(PSLICE() << "Read from " << info_.native_fd() << " has failed");
|
||||
}
|
||||
};
|
||||
void BufferedStdinImplDeleter::operator()(BufferedStdinImpl *impl) {
|
||||
|
Reference in New Issue
Block a user