MIRA
RPCError.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 by
3  * MetraLabs GmbH (MLAB), GERMANY
4  * and
5  * Neuroinformatics and Cognitive Robotics Labs (NICR) at TU Ilmenau, GERMANY
6  * All rights reserved.
7  *
8  * Contact: info@mira-project.org
9  *
10  * Commercial Usage:
11  * Licensees holding valid commercial licenses may use this file in
12  * accordance with the commercial license agreement provided with the
13  * software or, alternatively, in accordance with the terms contained in
14  * a written agreement between you and MLAB or NICR.
15  *
16  * GNU General Public License Usage:
17  * Alternatively, this file may be used under the terms of the GNU
18  * General Public License version 3.0 as published by the Free Software
19  * Foundation and appearing in the file LICENSE.GPL3 included in the
20  * packaging of this file. Please review the following information to
21  * ensure the GNU General Public License version 3.0 requirements will be
22  * met: http://www.gnu.org/copyleft/gpl.html.
23  * Alternatively you may (at your option) use any later version of the GNU
24  * General Public License if such license has been publicly approved by
25  * MLAB and NICR (or its successors, if any).
26  *
27  * IN NO EVENT SHALL "MLAB" OR "NICR" BE LIABLE TO ANY PARTY FOR DIRECT,
28  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
29  * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF "MLAB" OR
30  * "NICR" HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * "MLAB" AND "NICR" SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
33  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
34  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
35  * ON AN "AS IS" BASIS, AND "MLAB" AND "NICR" HAVE NO OBLIGATION TO
36  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR MODIFICATIONS.
37  */
38 
48 #ifndef _MIRA_RPCERROR_H_
49 #define _MIRA_RPCERROR_H_
50 
51 #include <error/Exceptions.h>
53 #include <serialization/adapters/boost/shared_ptr.hpp>
54 
55 namespace mira {
56 
58 
65 {
70 };
71 
76 class XRPC : public XRuntime
77 {
79 protected:
81  XRPC() {}
82 
83 public:
84  XRPC(const std::string& msg, const char* file=NULL, int line=0) :
85  XRuntime(msg, file, line) {}
86 
88 
89  template<typename Reflector>
90  void reflect(Reflector& r) {
91  MIRA_REFLECT_BASE(r, XRuntime);
92  r.member("OriginalException", origException, "");
93  }
94 
95  virtual void raise(bool recursive = false)
96  {
97  if (recursive && origException)
98  origException->raise(recursive);
99 
100  throw *this;
101  }
102 
103 public:
104 
108  bool hasOrigException() { return (bool)origException; }
109  void raiseOrigException(bool recursive = false) { origException->raise(recursive); }
110 
111 protected:
113 };
114 
116 
117 } // namespace
118 
119 #endif
Invalid parameters were specified for the method.
Definition: RPCError.h:68
PropertyHint file(const std::string &filters=std::string(), bool save=false)
Tells the property editor that the path is for a file, and that it should show a "File Open"/"File Sa...
Definition: Path.h:247
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
#define MIRA_REFLECT_BASE(reflector, BaseClass)
Macro that can be used to reflect the base class easily.
Definition: ReflectorInterface.h:912
SerializableExceptionPtr origException
Definition: RPCError.h:112
void reflect(Reflector &r)
Definition: RPCError.h:90
bool hasOrigException()
Definition: RPCError.h:108
Contains the base interface of all Reflectors, Serializers, etc.
Commonly used exception classes.
An exception that is thrown by the RPCServer if an RPC call fails.
Definition: RPCError.h:76
An exception has occurred within the method that was called.
Definition: RPCError.h:69
XRPC(const std::string &msg, const char *file=NULL, int line=0)
Definition: RPCError.h:84
virtual ~XRPC() MIRA_NOEXCEPT_OR_NOTHROW
Definition: RPCError.h:87
#define MIRA_NOEXCEPT_OR_NOTHROW
Definition: NoExcept.h:99
RPCError
enumeration of possible reasons for errors/exceptions while performing an RPC call ...
Definition: RPCError.h:64
#define MIRA_OBJECT(classIdentifier)
Use this MACRO if you like the factory to automatically extract the class name from the given identif...
Definition: FactoryMacros.h:179
void setOrigException(SerializableException *ex)
takes ownership of ex
Definition: RPCError.h:106
boost::shared_ptr< SerializableException > SerializableExceptionPtr
Definition: Exceptions.h:142
void raiseOrigException(bool recursive=false)
Definition: RPCError.h:109
Requested method was not found.
Definition: RPCError.h:67
XRPC()
Definition: RPCError.h:81
friend class ClassFactoryDefaultConstClassBuilder
Definition: RPCError.h:80
The request is invalid or can not be parsed.
Definition: RPCError.h:66
Definition: Exceptions.h:85
void setOrigException(SerializableExceptionPtr ex)
Definition: RPCError.h:107