zmqpp  4.1.2
C++ bindings for 0mq (libzmq)
exception.hpp
Go to the documentation of this file.
1 /*
2  * This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5  *
6  * This file is part of zmqpp.
7  * Copyright (c) 2011-2015 Contributors as noted in the AUTHORS file.
8  */
9 
17 #ifndef ZMQPP_EXCEPTION_HPP_
18 #define ZMQPP_EXCEPTION_HPP_
19 
20 #include <stdexcept>
21 #include <string>
22 
23 #include <zmq.h>
24 
25 #include "compatibility.hpp"
26 
27 namespace zmqpp
28 {
29 
42 class ZMQPP_EXPORT exception : public std::runtime_error
43 {
44 public:
50  exception(std::string const& message)
51  : std::runtime_error(message)
52  { }
53 };
54 
61 {
62 public:
63  invalid_instance(std::string const& message)
65  { }
66 };
67 
72  {
73  public:
74 
76  exception("Actor Initialization Exception")
77  {
78  }
79 
80  };
81 
87  {
88  public:
89  z85_exception(const std::string &msg):
90  exception(msg)
91  {
92  }
93  };
94 
103 {
104 public:
109  : exception(zmq_strerror(zmq_errno()))
110  , _error(zmq_errno())
111  { }
112 
117  int zmq_error() const { return _error; }
118 
119 private:
120  int _error;
121 };
122 
123 }
124 
125 #endif /* ZMQPP_EXCEPTION_HPP_ */
ZMQPP_EXPORT
#define ZMQPP_EXPORT
Definition: compatibility.hpp:39
zmqpp
C++ wrapper around zmq.
Definition: actor.cpp:30
zmqpp::zmq_internal_exception::zmq_error
int zmq_error() const
Retrieve the zmq error number associated with this exception.
Definition: exception.hpp:117
zmqpp::message
a zmq message with optional multipart support
Definition: message.hpp:44
zmqpp::exception::exception
exception(std::string const &message)
Standard exception constructor.
Definition: exception.hpp:50
zmqpp::zmq_internal_exception::_error
int _error
Definition: exception.hpp:120
zmqpp::actor_initialization_exception::actor_initialization_exception
actor_initialization_exception()
Definition: exception.hpp:75
compatibility.hpp
zmqpp::z85_exception
Thrown when an error occurs while encoding or decoding to/from z85.
Definition: exception.hpp:87
zmqpp::exception
Represents the base zmqpp exception.
Definition: exception.hpp:43
zmqpp::z85_exception::z85_exception
z85_exception(const std::string &msg)
Definition: exception.hpp:89
zmqpp::zmq_internal_exception::zmq_internal_exception
zmq_internal_exception()
Uses the zmq functions to pull out error messages and numbers.
Definition: exception.hpp:108
zmqpp::actor_initialization_exception
Represents a failed zmqpp::actor initialization.
Definition: exception.hpp:72
zmqpp::invalid_instance::invalid_instance
invalid_instance(std::string const &message)
Definition: exception.hpp:63
zmqpp::invalid_instance
Represents an attempt to use an invalid object.
Definition: exception.hpp:61
zmqpp::zmq_internal_exception
Represents internal zmq errors.
Definition: exception.hpp:103