| Home | Libraries | People | FAQ | More

# boost::asio::error Class Reference

Inherits std::exception.

Inheritance diagram for boost::asio::error:

List of all members.

## Detailed Description

The error class is used to encapsulate system error codes.

## Public Types

| access_denied = implementation_defined
| Permission denied.
| address_family_not_supported = implementation_defined
| Address family not supported by protocol.
| address_in_use = implementation_defined
| Address already in use.
| already_connected = implementation_defined
| Transport endpoint is already connected.
| already_started = implementation_defined
| Operation already in progress.
| connection_aborted = implementation_defined
| A connection has been aborted.
| connection_refused = implementation_defined
| Connection refused.
| connection_reset = implementation_defined
| Connection reset by peer.
| bad_descriptor = implementation_defined
| Bad file descriptor.
| eof = implementation_defined
| End of file or stream.
| fault = implementation_defined
| Bad address.
| host_not_found = implementation_defined
| Host not found (authoritative).
| host_not_found_try_again = implementation_defined
| Host not found (non-authoritative).
| host_unreachable = implementation_defined
| No route to host.
| in_progress = implementation_defined
| Operation now in progress.
| interrupted = implementation_defined
| Interrupted system call.
| invalid_argument = implementation_defined
| Invalid argument.
| message_size = implementation_defined
| Message too long.
| network_down = implementation_defined
| Network is down.
| network_reset = implementation_defined
| Network dropped connection on reset.
| network_unreachable = implementation_defined
| Network is unreachable.
| no_descriptors = implementation_defined
| Too many open files.
| no_buffer_space = implementation_defined
| No buffer space available.
| no_data = implementation_defined
| The query is valid but does not have associated address data.
| no_memory = implementation_defined
| Cannot allocate memory.
| no_permission = implementation_defined
| Operation not permitted.
| no_protocol_option = implementation_defined
| Protocol not available.
| no_recovery = implementation_defined
| A non-recoverable error occurred.
| not_connected = implementation_defined
| Transport endpoint is not connected.
| not_socket = implementation_defined
| Socket operation on non-socket.
| not_supported = implementation_defined
| Operation not supported.
| operation_aborted = implementation_defined
| Operation cancelled.
| service_not_found
| The service is not supported for the given socket type.
| socket_type_not_supported
| The socket type is not supported.
| shut_down = implementation_defined
| Cannot send after transport endpoint shutdown.
| success = 0
| Success.
| timed_out = implementation_defined
| Connection timed out.
| try_again = implementation_defined
| Resource temporarily unavailable.
| would_block = implementation_defined
| The socket is marked non-blocking and the requested operation would block.
enum | code_type { access_denied = implementation_defined, address_family_not_supported = implementation_defined, address_in_use = implementation_defined, already_connected = implementation_defined,
already_started = implementation_defined,
connection_aborted = implementation_defined,
connection_refused = implementation_defined,
connection_reset = implementation_defined,
bad_descriptor = implementation_defined,
eof = implementation_defined,
fault = implementation_defined,
host_not_found = implementation_defined,
host_not_found_try_again = implementation_defined,
host_unreachable = implementation_defined,
in_progress = implementation_defined,
interrupted = implementation_defined,
invalid_argument = implementation_defined,
message_size = implementation_defined,
network_down = implementation_defined,
network_reset = implementation_defined,
network_unreachable = implementation_defined,
no_descriptors = implementation_defined,
no_buffer_space = implementation_defined,
no_data = implementation_defined,
no_memory = implementation_defined,
no_permission = implementation_defined,
no_protocol_option = implementation_defined,
no_recovery = implementation_defined,
not_connected = implementation_defined,
not_socket = implementation_defined,
not_supported = implementation_defined,
operation_aborted = implementation_defined,
service_not_found,
socket_type_not_supported,
shut_down = implementation_defined,
success = 0,
timed_out = implementation_defined,
try_again = implementation_defined,
would_block = implementation_defined
}
| Error codes. More...

## Public Member Functions

| error ()
| Default constructor.
| error (int code)
| Construct with a specific error code.
| error (const error &e)
| Copy constructor.
virtual | ~error () throw ()
| Destructor.
error & | operator= (const error &e)
| Assignment operator.
virtual const char * | what () const throw ()
| Get a string representation of the exception.
int | code () const
| Get the code associated with the error.
| operator unspecified_bool_type () const
| Operator returns non-null if there is a non-success error code.
bool | operator! () const
| Operator to test if the error represents success.

## Friends

bool | operator== (const error &e1, const error &e2)
| Equality operator to compare two error objects.
bool | operator!= (const error &e1, const error &e2)
| Inequality operator to compare two error objects.

## Related Functions

(Note that these are not member functions.)
template<typename Ostream>
Ostream & | operator<< (Ostream &os, const error &e)
| Output the string associated with an error.

## Member Enumeration Documentation

enum boost::asio::error::code_type

Error codes.

Enumerator:

  access_denied | Permission denied.
  address_family_not_supported | Address family not supported by protocol.
  address_in_use | Address already in use.
  already_connected | Transport endpoint is already connected.
  already_started | Operation already in progress.
  connection_aborted | A connection has been aborted.
  connection_refused | Connection refused.
  connection_reset | Connection reset by peer.
  bad_descriptor | Bad file descriptor.
  eof | End of file or stream.
  fault | Bad address.
  host_not_found | Host not found (authoritative).
  host_not_found_try_again | Host not found (non-authoritative).
  host_unreachable | No route to host.
  in_progress | Operation now in progress.
  interrupted | Interrupted system call.
  invalid_argument | Invalid argument.
  message_size | Message too long.
  network_down | Network is down.
  network_reset | Network dropped connection on reset.
  network_unreachable | Network is unreachable.
  no_descriptors | Too many open files.
  no_buffer_space | No buffer space available.
  no_data | The query is valid but does not have associated address data.
  no_memory | Cannot allocate memory.
  no_permission | Operation not permitted.
  no_protocol_option | Protocol not available.
  no_recovery | A non-recoverable error occurred.
  not_connected | Transport endpoint is not connected.
  not_socket | Socket operation on non-socket.
  not_supported | Operation not supported.
  operation_aborted | Operation cancelled.
  service_not_found | The service is not supported for the given socket type.
  socket_type_not_supported | The socket type is not supported.
  shut_down | Cannot send after transport endpoint shutdown.
  success | Success.
  timed_out | Connection timed out.
  try_again | Resource temporarily unavailable.
  would_block | The socket is marked non-blocking and the requested operation would block.

## Constructor & Destructor Documentation

boost::asio::error::error | ( |  | ) |

Default constructor.

boost::asio::error::error | ( | int | code | ) |

Construct with a specific error code.

boost::asio::error::error | ( | const error & | e | ) |

Copy constructor.

virtual boost::asio::error::~error | ( |  | ) | throw ()`[virtual]`

Destructor.

## Member Function Documentation

error& boost::asio::error::operator= | ( | const error & | e | ) |

Assignment operator.

virtual const char* boost::asio::error::what | ( |  | ) | const throw ()`[virtual]`

Get a string representation of the exception.

int boost::asio::error::code | ( |  | ) | const

Get the code associated with the error.

boost::asio::error::operator unspecified_bool_type | ( |  | ) | const

Operator returns non-null if there is a non-success error code.

bool boost::asio::error::operator! | ( |  | ) | const

Operator to test if the error represents success.

## Friends And Related Function Documentation

bool operator== | ( | const error & | e1,
|  | const error & | e2 |
| ) |  |  | `[friend]`

Equality operator to compare two error objects.

bool operator!= | ( | const error & | e1,
|  | const error & | e2 |
| ) |  |  | `[friend]`

Inequality operator to compare two error objects.

template<typename Ostream>

Ostream & operator<< | ( | Ostream & | os,
|  | const error & | e |
| ) |  |  | `[related]`

Output the string associated with an error.

Used to output a human-readable string that is associated with an error.

Parameters:

  | os | The output stream to which the string will be written.
  | e | The error to be written.

Returns:
  The output stream.

| Copyright © 2003 - 2006 Christopher M. Kohlhoff