fipa_services
ErrorHandling.hpp
Go to the documentation of this file.
1 #ifndef FIPA_SERVICE_ERROR_HANDLING_HPP
2 #define FIPA_SERVICE_ERROR_HANDLING_HPP
3 
4 #include <string>
5 #include <stdexcept>
6 
7 #define FIPA_SERVICE_EXCEPTION(NAME, BASE_MSG) \
8  class NAME : public std::runtime_error {\
9  public: \
10  NAME() : std::runtime_error(BASE_MSG) \
11  {}; \
12  NAME(const std::string& msg) : std::runtime_error(BASE_MSG + msg) \
13  {}; \
14  };
15 
16 namespace fipa {
17 namespace services {
18 
19 FIPA_SERVICE_EXCEPTION(DuplicateEntry, "Entry already exists: ")
20 FIPA_SERVICE_EXCEPTION(NotFound, "Entry could not be found: ")
21 FIPA_SERVICE_EXCEPTION(NotImplemented, "Function has not been implemeted yet: ")
22 FIPA_SERVICE_EXCEPTION(ArgumentError, "Invalid argument provided: ")
23 
24 } // end namespace services
25 } // end namespace fipa
26 
27 #endif // FIPA_SERVICE_ERROR_HANDLING_HPP
#define FIPA_SERVICE_EXCEPTION(NAME, BASE_MSG)
Definition: ErrorHandling.hpp:7
Definition: DistributedServiceDirectory.cpp:5