ZIO
Python and C++ interface to ZeroMQ and Zyre
test_exceptions.cxx
Go to the documentation of this file.
1 #include "zio/exceptions.hpp"
2 
3 #include <iostream>
4 
5 int main()
6 {
7  try {
8  throw zio::socket_error::create(42, "question unknown", "extra smack talk");
9  }
10  catch (zio::exception& e) {
11  std::cout << e.what() << std::endl;
12  }
13 
14  auto e = zio::socket_error::create();
15  std::cout << e.what() << std::endl;
16  auto m = zio::message_error::create(404, "communication breakdown");
17  std::cout << m.what() << std::endl;
18  return 0;
19 }
static message_error create(int id_, const char *errmsg, const char *extra=NULL)
Definition: exceptions.hpp:78
const char * what() const noexcept override
returns the explanatory string
Definition: exceptions.hpp:20
general exception class for zio
Definition: exceptions.hpp:16
static socket_error create(int id_, const char *errmsg, const char *extra=NULL)
Create a socket error with all data and optional extra message.
Definition: exceptions.hpp:46
int main()