source: trunk/yat/Exception.h @ 1191

Last change on this file since 1191 was 1191, 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 2330 2010-10-01 14:41:52Z peter $
5
6/*
7  Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2010 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 std::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  class errno_error : public std::runtime_error
70  {
71  public:
72    /**
73       The error message, return from what(), is set to
74       \a message + strerror(errno)
75     */
76    errno_error(std::string message);
77  };
78
79  /**
80     \brief Class for errors reported from underlying GSL calls.
81
82     GSL_error is used in the same way as C++ standard library
83     exceptions.
84  */
85  class GSL_error : public std::runtime_error
86  {
87  public:
88    /**
89       \brief Constructor to create an exception with a message.
90    */
91    GSL_error(std::string message);
92
93    /**
94       \brief Constructor to create an exception with a message
95       containg the GSL error description.
96    */
97    GSL_error(std::string message, int gsl_status);
98  };
99
100
101  /**
102     \brief Class to report errors associated with IO operations.
103
104     IO_error is used in the same way as C++ standard library
105     exceptions.
106  */
107  class IO_error : public std::runtime_error
108  {
109  public:
110    /**
111       \brief Constructor to create an exception with a message.
112    */
113    IO_error(std::string message);
114  };
115
116}}} // of namespace utility, yat, and theplu
117
118#endif
Note: See TracBrowser for help on using the repository browser.