Exceptions.hpp
Go to the documentation of this file.
1 /****************************************************************
2  *
3  * Copyright (c) 2011
4  * All rights reserved.
5  *
6  * Hochschule Bonn-Rhein-Sieg
7  * University of Applied Sciences
8  * Computer Science Department
9  *
10  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11  *
12  * Author:
13  * Jan Paulus, Nico Hochgeschwender, Michael Reckhaus, Azamat Shakhimardanov
14  * Supervised by:
15  * Gerhard K. Kraetzschmar
16  *
17  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
18  *
19  * This sofware is published under a dual-license: GNU Lesser General Public
20  * License LGPL 2.1 and BSD license. The dual-license implies that users of this
21  * code may choose which terms they prefer.
22  *
23  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
24  *
25  * Redistribution and use in source and binary forms, with or without
26  * modification, are permitted provided that the following conditions are met:
27  *
28  * * Redistributions of source code must retain the above copyright
29  * notice, this list of conditions and the following disclaimer.
30  * * Redistributions in binary form must reproduce the above copyright
31  * notice, this list of conditions and the following disclaimer in the
32  * documentation and/or other materials provided with the distribution.
33  * * Neither the name of the Hochschule Bonn-Rhein-Sieg nor the names of its
34  * contributors may be used to endorse or promote products derived from
35  * this software without specific prior written permission.
36  *
37  * This program is free software: you can redistribute it and/or modify
38  * it under the terms of the GNU Lesser General Public License LGPL as
39  * published by the Free Software Foundation, either version 2.1 of the
40  * License, or (at your option) any later version or the BSD license.
41  *
42  * This program is distributed in the hope that it will be useful,
43  * but WITHOUT ANY WARRANTY; without even the implied warranty of
44  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45  * GNU Lesser General Public License LGPL and the BSD license for more details.
46  *
47  * You should have received a copy of the GNU Lesser General Public
48  * License LGPL and BSD license along with this program.
49  *
50  ****************************************************************/
51 
52 #ifndef _EXCEPTIONS_HPP
53 #define _EXCEPTIONS_HPP
54 
55 
56 #include <exception>
57 #include <stdexcept>
58 #include <iostream>
59 #include <string>
60 
61 using namespace std;
62 namespace youbot {
63 
65  class FileNotFoundException : public std::ios_base::failure {
66  string msg;
67 
68  public:
69  // Takes a character string describing the error.
70  explicit FileNotFoundException(const string& message) throw ()
71  :std::ios_base::failure(message) {
72  msg = message + " file not found" ;
73  };
74 
75  virtual ~FileNotFoundException() throw () {
76  };
77 
78  // Returns a C-style character string describing the general cause of the current error
79  virtual const char* what() const throw () {
80  return msg.c_str();
81  };
82  };
83 
85  class KeyNotFoundException : public std::ios_base::failure {
86  string msg;
87 
88  public:
89  // Takes a character string describing the error.
90  explicit KeyNotFoundException(const string& message) throw ()
91  :std::ios_base::failure(message) {
92  msg = message + " key in config file not found" ;
93  };
94 
95  virtual ~KeyNotFoundException() throw () {
96  };
97 
98  // Returns a C-style character string describing the general cause of the current error
99  virtual const char* what() const throw () {
100  return msg.c_str();
101  };
102  };
104  class JointParameterException : public std::runtime_error {
105  string msg;
106 
107  public:
108  // Takes a character string describing the error.
109  explicit JointParameterException(const string& message) throw()
110  : std::runtime_error(message) {
111  msg = message;
112  };
113 
114  virtual ~JointParameterException() throw () {
115  };
116 
117  // Returns a C-style character string describing the general cause of the current error
118  virtual const char* what() const throw () {
119  return msg.c_str();
120  };
121  };
123  class JointErrorException : public std::runtime_error {
124  string msg;
125 
126  public:
127  // Takes a character string describing the error.
128  explicit JointErrorException(const string& message) throw ()
129  :std::runtime_error(message) {
130  msg = message;
131  };
132 
133  virtual ~JointErrorException() throw () {
134  };
135 
136  // Returns a C-style character string describing the general cause of the current error
137  virtual const char* what() const throw () {
138  return msg.c_str();
139  };
140  };
142  class EtherCATConnectionException : public std::runtime_error {
143  string msg;
144 
145  public:
146  // Takes a character string describing the error.
147  explicit EtherCATConnectionException(const string& message) throw ()
148  :std::runtime_error(message) {
149  msg = message;
150  };
151 
152  virtual ~EtherCATConnectionException() throw () {
153  };
154 
155  // Returns a C-style character string describing the general cause of the current error
156  virtual const char* what() const throw () {
157  return msg.c_str();
158  };
159  };
160 
161 
162 
163 
164 
165 } // namespace youbot
166 #endif //_EXCEPTIONS_HPP
EtherCATConnectionException(const string &message)
Definition: Exceptions.hpp:147
virtual const char * what() const
Definition: Exceptions.hpp:137
virtual const char * what() const
Definition: Exceptions.hpp:118
File not found exception.
Definition: Exceptions.hpp:65
virtual const char * what() const
Definition: Exceptions.hpp:156
Joint parameter exception.
Definition: Exceptions.hpp:104
JointErrorException(const string &message)
Definition: Exceptions.hpp:128
FileNotFoundException(const string &message)
Definition: Exceptions.hpp:70
virtual const char * what() const
Definition: Exceptions.hpp:99
JointParameterException(const string &message)
Definition: Exceptions.hpp:109
Key in configuration file not found exception.
Definition: Exceptions.hpp:85
Joint error exception.
Definition: Exceptions.hpp:123
EtherCAT Connection Error.
Definition: Exceptions.hpp:142
virtual const char * what() const
Definition: Exceptions.hpp:79
KeyNotFoundException(const string &message)
Definition: Exceptions.hpp:90


youbot_driver
Author(s): Jan Paulus
autogenerated on Mon Jun 10 2019 15:46:24