Base Framework
Public Types | Public Member Functions | List of all members
NetworkException Class Reference

Network IO exception. More...

#include <base/net/NetworkException.h>

Inherits IOException.

Inherited by HostNotFound, HTTPException, ServiceNotFound, and WebSocketException.

Public Types

enum  Cause {
  ALREADY_CONNECTED, NOT_CONNECTED, CONNECTION_TIMED_OUT, ADDRESS_NOT_AVAILABLE,
  ADDRESS_IN_USE, DESTINATION_REQUIRED, FAMILY_NOT_SUPPORTED, PROTOCOL_NOT_SUPPORTED,
  TYPE_NOT_SUPPORTED, OPERATION_NOT_SUPPORTED, IN_PROGRESS, NON_BLOCKING,
  CONNECTION_ABORTED, CONNECTION_REFUSED, CONNECTION_RESET, HOST_DOWN,
  HOST_UNREACHABLE, PREVIOUS_DATAGRAM_REJECTED, NETWORK_DOWN, NETWORK_RESET,
  NETWORK_UNREACHABLE
}
 
- Public Types inherited from IOException
enum  Cause { ABORTED, BROKEN_STREAM, PENDING }
 
- Public Types inherited from Exception
enum  DumpOnThrow { DUMP_ON_THROW_NO = 0, DUMP_ON_THROW_EXCEPTION, DUMP_ON_THROW_STACK }
 
typedef void(* ExceptionHandler) (const Exception *exception)
 

Public Member Functions

 NetworkException () noexcept
 
 NetworkException (const char *message) noexcept
 
 NetworkException (const Type &type) noexcept
 
 NetworkException (const char *message, const Type &type) noexcept
 
 NetworkException (const char *message, const Type &type, unsigned int cause) noexcept
 
 NetworkException (const char *message, const Type &type, unsigned int error, int) noexcept
 
- Public Member Functions inherited from IOException
 IOException () noexcept
 
 IOException (const char *message) noexcept
 
 IOException (const Type &type) noexcept
 
 IOException (const char *message, const Type &type) noexcept
 
- Public Member Functions inherited from Exception
 Exception () noexcept
 
 Exception (const char *message) noexcept
 
 Exception (const Type &type) noexcept
 
 Exception (const char *message, const Type &type) noexcept
 
 Exception (const Exception &copy) noexcept
 
 Exception (Exception &&move) noexcept
 
unsigned int getCause () const noexcept
 
void setCause (unsigned int cause) noexcept
 
unsigned int getError () const noexcept
 
void setError (unsigned int error) noexcept
 
const char * getMessage () const noexcept
 
void setMessage (const char *message) noexcept
 
template<decltype(sizeof(void *)) SIZE>
void setMessage (const char(&_message)[SIZE]) noexcept
 
virtual Type getThisType () const noexcept
 
const TypegetType () const noexcept
 
void setType (const Type &type) noexcept
 
virtual bool isCommonException () const noexcept
 
OwnedNativeString getHTML () const
 
virtual ~Exception () noexcept
 

Additional Inherited Members

- Static Public Member Functions inherited from Exception
static void onThrow (const Exception &exception) noexcept
 
static void rethrow ()
 
static bool getDumpExceptions () noexcept
 
static void setDumpExceptions (bool _dumpExceptions) noexcept
 
static ExceptionHandler setExceptionHandler (ExceptionHandler _exceptionHandler) noexcept
 
static bool hasPendingException () noexcept
 
static bool isUnwinding () noexcept
 
static unsigned int getPendingExceptions () noexcept
 
static const char * getStdExceptionName (const std::exception &e) noexcept
 
static Type getExceptionType () noexcept
 
static StackTrace getStackTrace ()
 
static void setDumpOnThrow (DumpOnThrow dumpOnThrow) noexcept
 
- Static Public Attributes inherited from Exception
static constexpr bool SUPPORTS_EXCEPTIONS = true
 

Detailed Description

Network IO exception.

Indicates a network exception.

Version
1.1

Member Enumeration Documentation

◆ Cause

Cause.

Enumerator
ALREADY_CONNECTED 

Socket has already been connected.

NOT_CONNECTED 

Socket has not been connected.

CONNECTION_TIMED_OUT 

Connection timed out.

ADDRESS_NOT_AVAILABLE 

Address is not available.

ADDRESS_IN_USE 

Address already in use.

DESTINATION_REQUIRED 

Destination address is required.

FAMILY_NOT_SUPPORTED 

Family not supported.

PROTOCOL_NOT_SUPPORTED 

Protocol not supported.

TYPE_NOT_SUPPORTED 

Type not supported.

OPERATION_NOT_SUPPORTED 

Operation not supported.

IN_PROGRESS 

Operation already in progress.

NON_BLOCKING 

Operation would have blocked.

CONNECTION_ABORTED 

Connection aborted locally.

CONNECTION_REFUSED 

Connection refused.

CONNECTION_RESET 

Connection aborted by peer.

HOST_DOWN 

Host is down or disconnected.

HOST_UNREACHABLE 

Host is not reachable.

PREVIOUS_DATAGRAM_REJECTED 

A previous datagram could not be delivered due to invalid message size.

NETWORK_DOWN 

Local network is not operational.

NETWORK_RESET 

Connection aborted by network.

NETWORK_UNREACHABLE 

Network is not reachable.

Constructor & Destructor Documentation

◆ NetworkException() [1/4]

NetworkException::NetworkException ( )
noexcept

Initializes the exception object with no message.

◆ NetworkException() [2/4]

NetworkException::NetworkException ( const char *  message)
noexcept

Initializes the exception object.

Parameters
messageThe message.

◆ NetworkException() [3/4]

NetworkException::NetworkException ( const Type type)
noexcept

Initializes the exception object without an associated message.

Parameters
typeThe identity of the type.

◆ NetworkException() [4/4]

NetworkException::NetworkException ( const char *  message,
const Type type 
)
noexcept

Initializes the exception object.

Parameters
messageAn NULL-terminated string (ASCII).
typeThe identity of the type.