Skip to content

Commit

Permalink
iox-eclipse-iceoryx#381 Address review findings from Christian Eltzsc…
Browse files Browse the repository at this point in the history
…hig re-introducing error prints in UnixDomainSocket

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
  • Loading branch information
mossmaurice committed Feb 11, 2021
1 parent ae49fbe commit dc55e69
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions iceoryx_utils/source/posix_wrapper/unix_domain_socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,90 +435,112 @@ cxx::error<IpcChannelError> UnixDomainSocket::createErrorFromErrnum(const int32_
{
case EACCES:
{
std::cerr << "permission to create unix domain socket denied \"" << m_name << "\"" << std::endl;
return cxx::error<IpcChannelError>(IpcChannelError::ACCESS_DENIED);
}
case EAFNOSUPPORT:
{
std::cerr << "address family not supported for unix domain socket \"" << m_name << "\"" << std::endl;
return cxx::error<IpcChannelError>(IpcChannelError::INVALID_ARGUMENTS);
}
case EINVAL:
{
std::cerr << "provided invalid arguments for unix domain socket \"" << m_name << "\"" << std::endl;
return cxx::error<IpcChannelError>(IpcChannelError::INVALID_ARGUMENTS);
}
case EMFILE:
{
std::cerr << "process limit reached for unix domain socket \"" << m_name << "\"" << std::endl;
return cxx::error<IpcChannelError>(IpcChannelError::PROCESS_LIMIT);
}
case ENFILE:
{
std::cerr << "system limit reached for unix domain socket \"" << m_name << "\"" << std::endl;
return cxx::error<IpcChannelError>(IpcChannelError::SYSTEM_LIMIT);
}
case ENOBUFS:
{
std::cerr << "out of memory for unix domain socket \"" << m_name << "\"" << std::endl;
return cxx::error<IpcChannelError>(IpcChannelError::OUT_OF_MEMORY);
}
case ENOMEM:
{
std::cerr << "out of memory for unix domain socket \"" << m_name << "\"" << std::endl;
return cxx::error<IpcChannelError>(IpcChannelError::OUT_OF_MEMORY);
}
case EPROTONOSUPPORT:
{
std::cerr << "protocol type not supported for unix domain socket \"" << m_name << "\"" << std::endl;
return cxx::error<IpcChannelError>(IpcChannelError::INVALID_ARGUMENTS);
}
case EADDRINUSE:
{
std::cerr << "unix domain socket already in use \"" << m_name << "\"" << std::endl;
return cxx::error<IpcChannelError>(IpcChannelError::CHANNEL_ALREADY_EXISTS);
}
case EBADF:
{
std::cerr << "invalid file descriptor for unix domain socket \"" << m_name << "\"" << std::endl;
return cxx::error<IpcChannelError>(IpcChannelError::INVALID_FILE_DESCRIPTOR);
}
case ENOTSOCK:
{
std::cerr << "invalid file descriptor for unix domain socket \"" << m_name << "\"" << std::endl;
return cxx::error<IpcChannelError>(IpcChannelError::INVALID_FILE_DESCRIPTOR);
}
case EADDRNOTAVAIL:
{
std::cerr << "interface or address error for unix domain socket \"" << m_name << "\"" << std::endl;
return cxx::error<IpcChannelError>(IpcChannelError::INVALID_CHANNEL_NAME);
}
case EFAULT:
{
std::cerr << "outside address space error for unix domain socket \"" << m_name << "\"" << std::endl;
return cxx::error<IpcChannelError>(IpcChannelError::INVALID_CHANNEL_NAME);
}
case ELOOP:
{
std::cerr << "too many symbolic links for unix domain socket \"" << m_name << "\"" << std::endl;
return cxx::error<IpcChannelError>(IpcChannelError::INVALID_CHANNEL_NAME);
}
case ENAMETOOLONG:
{
std::cerr << "name too long for unix domain socket \"" << m_name << "\"" << std::endl;
return cxx::error<IpcChannelError>(IpcChannelError::INVALID_CHANNEL_NAME);
}
case ENOTDIR:
{
std::cerr << "not a directory error for unix domain socket \"" << m_name << "\"" << std::endl;
return cxx::error<IpcChannelError>(IpcChannelError::INVALID_CHANNEL_NAME);
}
case ENOENT:
{
// no error message needed since this is a normal use case
return cxx::error<IpcChannelError>(IpcChannelError::NO_SUCH_CHANNEL);
}
case EROFS:
{
std::cerr << "read only error for unix domain socket \"" << m_name << "\"" << std::endl;
return cxx::error<IpcChannelError>(IpcChannelError::INVALID_CHANNEL_NAME);
}
case EIO:
{
std::cerr << "I/O for unix domain socket \"" << m_name << "\"" << std::endl;
return cxx::error<IpcChannelError>(IpcChannelError::I_O_ERROR);
}
case ENOPROTOOPT:
{
std::cerr << "invalid option for unix domain socket \"" << m_name << "\"" << std::endl;
return cxx::error<IpcChannelError>(IpcChannelError::INVALID_ARGUMENTS);
}
case ECONNREFUSED:
{
std::cerr << "No server for unix domain socket \"" << m_name << "\"" << std::endl;
return cxx::error<IpcChannelError>(IpcChannelError::NO_SUCH_CHANNEL);
}
case ECONNRESET:
{
std::cerr << "connection was reset by peer for \"" << m_name << "\"" << std::endl;
return cxx::error<IpcChannelError>(IpcChannelError::CONNECTION_RESET_BY_PEER);
}
case EWOULDBLOCK:
Expand Down

0 comments on commit dc55e69

Please sign in to comment.