ServiceException

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

Writes a string representation of exc to the stream os.

class cppmicroservices::ServiceException : public std::runtime_error
#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.

Public Types

enum Type

Values:

enumerator UNSPECIFIED

No exception type is unspecified.

enumerator UNREGISTERED

The service has been unregistered.

enumerator FACTORY_ERROR

The service factory produced an invalid service object.

enumerator FACTORY_EXCEPTION

The service factory threw an exception.

enumerator REMOTE

An error occurred invoking a remote service.

enumerator FACTORY_RECURSION

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

Public Functions

ServiceException(std::string const &msg, Type const &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(ServiceException const &o)
ServiceException &operator=(ServiceException const &o)
~ServiceException() override
Type GetType() const

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

Return

The type of this exception.