ServiceException

std::ostream &operator<<(std::ostream &os, const cppmicroservices::ServiceException &exc)

Writes a string representation of exc to the stream os.

class cppmicroservices::ServiceException
#include <cppmicroservices/ServiceException.h>

A service exception used to indicate that a service problem occurred.

A ServiceException object is created by the framework or to denote an exception condition in the service. An enum type is used to identify the exception type for future extendability.

This exception conforms to the general purpose exception chaining mechanism.

Inherits from std::runtime_error

Public Types

enum Type

Values:

UNSPECIFIED = 0

No exception type is unspecified.

UNREGISTERED = 1

The service has been unregistered.

FACTORY_ERROR = 2

The service factory produced an invalid service object.

FACTORY_EXCEPTION = 3

The service factory threw an exception.

REMOTE = 5

An error occurred invoking a remote service.

FACTORY_RECURSION = 6

The service factory resulted in a recursive call to itself for the requesting bundle.

Public Functions

ServiceException(const std::string &msg, const Type &type = UNSPECIFIED)

Creates a ServiceException with the specified message, type and exception cause.

Parameters
  • msg: The associated message.
  • type: The type for this exception.

ServiceException(const ServiceException &o)
ServiceException &operator=(const ServiceException &o)
~ServiceException()
Type GetType() const

Returns the type for this exception or UNSPECIFIED if the type was unspecified or unknown.

Return
The type of this exception.