source: trunk/yat/utility/Exception.h @ 738

Last change on this file since 738 was 738, checked in by Jari Häkkinen, 16 years ago

Fixes #8 and #179, addresses #2.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
1#ifndef _theplu_yat_utility_exception_
2#define _theplu_yat_utility_exception_
3
4// $Id: Exception.h 738 2007-01-07 23:08:39Z jari $
5
6/*
7  Copyright (C) 2005 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2006 Jari Häkkinen
9
10  This file is part of the yat library, http://lev.thep.lu.se/trac/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 2 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 this program; if not, write to the Free Software
24  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25  02111-1307, USA.
26*/
27
28#include <stdexcept>
29#include <string>
30
31namespace theplu {
32namespace yat {
33namespace utility {
34
35  /**
36     \brief Class for errors reported from underlying GSL calls.
37  */
38  class GSL_error : public std::runtime_error
39  {
40  public:
41    /**
42       \brief The default constructor
43    */
44    inline GSL_error(void) throw() : std::runtime_error("GSL_error:") {}
45
46    /**
47       \brief Constructor to create an exception with a message
48    */
49    inline GSL_error(std::string message) throw()
50      : std::runtime_error("IO_error: " + message) {}
51  };
52
53
54  ///
55  /// @brief Class for IO errors
56  ///
57  class IO_error : public std::runtime_error
58  {
59  public:
60    ///
61    /// Default constructor
62    ///
63    inline IO_error(void) throw() : std::runtime_error("IO_error:") {}
64
65    /**
66       \brief Constructor to create an exception with a message
67    */
68    inline IO_error(std::string message) throw()
69      : std::runtime_error("IO_error: " + message) {}
70  };
71
72}}} // of namespace utility, yat, and theplu
73
74#endif
Note: See TracBrowser for help on using the repository browser.