source: trunk/yat/Exception.h @ 1397

Last change on this file since 1397 was 1397, checked in by Peter Johansson, 12 years ago

latest yat

  • Property svn:eol-style set to native
File size: 2.7 KB
Line 
1#ifndef _theplu_yat_utility_exception_
2#define _theplu_yat_utility_exception_
3
4// $Id: Exception.h 2526 2011-07-25 02:03:35Z peter $
5
6/*
7  Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2010, 2011 Peter Johansson
9
10  This file is part of the yat library, http://dev.thep.lu.se/yat
11
12  The yat library is free software; you can redistribute it and/or
13  modify it under the terms of the GNU General Public License as
14  published by the Free Software Foundation; either version 3 of the
15  License, or (at your option) any later version.
16
17  The yat library is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  General Public License for more details.
21
22  You should have received a copy of the GNU General Public License
23  along with yat. If not, see <http://www.gnu.org/licenses/>.
24*/
25
26#include <stdexcept>
27#include <string>
28
29namespace theplu {
30namespace yat {
31namespace utility {
32
33 
34
35  /**
36     \brief Class used for all runtime error detected within yat library.
37   */
38  class runtime_error : public std::runtime_error
39  {
40  public:
41    /**
42       \brief Constructor
43
44       \param message message to be displayed using function what().
45     */
46    runtime_error(std::string message);
47  };
48
49
50  /**
51     \brief Class used for error reported from Commandline or Option.
52   */
53  class cmd_error : public runtime_error
54  {
55  public:
56    /**
57       \brief Constructor
58
59       \param message message to be displayed using function what().
60     */
61    cmd_error(std::string message);
62  };
63
64
65  /**
66     \brief Class that contains information reported via global
67     variable errno.
68
69     \since New in yat 0.7
70   */
71  class errno_error : public runtime_error
72  {
73  public:
74    /**
75       The error message, return from what(), is set to
76       \a message + strerror(errno)
77     */
78    errno_error(std::string message);
79  };
80
81  /**
82     \brief Class for errors reported from underlying GSL calls.
83
84     GSL_error is used in the same way as C++ standard library
85     exceptions.
86  */
87  class GSL_error : public runtime_error
88  {
89  public:
90    /**
91       \brief Constructor to create an exception with a message.
92    */
93    GSL_error(std::string message);
94
95    /**
96       \brief Constructor to create an exception with a message
97       containg the GSL error description.
98    */
99    GSL_error(std::string message, int gsl_status);
100  };
101
102
103  /**
104     \brief Class to report errors associated with IO operations.
105
106     IO_error is used in the same way as C++ standard library
107     exceptions.
108  */
109  class IO_error : public runtime_error
110  {
111  public:
112    /**
113       \brief Constructor to create an exception with a message.
114    */
115    IO_error(std::string message);
116  };
117
118}}} // of namespace utility, yat, and theplu
119
120#endif
Note: See TracBrowser for help on using the repository browser.