17.2. Exceptions

Fast DDS provides a RpcException base class for all the exceptions that can be thrown by the RPC API. It also provides some builtin exceptions, described in the following table:

RPC Builtin Exceptions

Exception

Description

RpcBrokenPipeException

Exception thrown by the RPC API when the communication with the remote endpoint breaks.

RpcFeedCancelledException

Exception thrown by the RPC API when the feed is cancelled.

RpcTimeoutException

Exception thrown by the RPC API when an operation times out.

According to the RPC over DDS specification 7.5.2, server-side error conditions are communicated back to the client using error codes, represented by the RemoteExceptionCode_t enumeration. Fast DDS provides a RpcRemoteException subclass that serves as a base class for a set of exceptions that can be thrown by the RPC API when a server-side error condition occurs.

The following table describes the equivalence between error codes and exceptions:

Equivalence between error codes and exceptions

Error code

Description

Exception

REMOTE_EX_UNSUPPORTED

Operation is valid but it is unsupported (a.k.a. not implemented).

RemoteUnsupportedError

REMOTE_EX_INVALID_ARGUMENT

The value of a parameter passed has an illegal value.

RemoteInvalidArgumentError

REMOTE_EX_OUT_OF_RESOURCES

The remote service ran out of resources while processing the request.

RemoteOutOfResourcesError

REMOTE_EX_UNKNOWN_OPERATION

The operation called is unknown.

RemoteUnknownOperationError

REMOTE_EX_UNKNOWN_EXCEPTION

A generic, unspecified exception was raised by the service implementation.

RemoteUnknownExceptionError

Finally, user can also define custom exceptions in the IDL interface file (see Exceptions), that can be raised by calling an operation method. Fast DDS provides a RpcOperationError subclass that serves as a base class for all these kind of exceptions, which are generated by Fast DDS-Gen tool from the IDL file.