source: trunk/lib/yat/Exception.h @ 983

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

fetch yat files. refs #429

  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1#ifndef _theplu_yat_utility_exception_
2#define _theplu_yat_utility_exception_
3
4// $Id: Exception.h 2119 2009-12-12 23:11:43Z peter $
5
6/*
7  Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
8
9  This file is part of the yat library, http://dev.thep.lu.se/yat
10
11  The yat library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 3 of the
14  License, or (at your option) any later version.
15
16  The yat library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20
21  You should have received a copy of the GNU General Public License
22  along with yat. If not, see <http://www.gnu.org/licenses/>.
23*/
24
25#include <stdexcept>
26#include <string>
27
28namespace theplu {
29namespace yat {
30namespace utility {
31
32  /**
33     \brief Class used for error reported from Commandline or Option.
34   */
35  class cmd_error : public std::runtime_error
36  {
37  public:
38    /**
39       \brief Constructor
40
41       \param message message to be displayed using function what().
42     */
43    inline cmd_error(std::string message)
44      : std::runtime_error(message) {}
45  };
46
47
48  /**
49     \brief Class to report errors associated with IO operations.
50
51     IO_error is used in the same way as C++ standard library
52     exceptions.
53  */
54  class IO_error : public std::runtime_error
55  {
56  public:
57    /**
58       \brief Constructor to create an exception with a message.
59    */
60    inline IO_error(std::string message) throw()
61      : std::runtime_error("IO_error: " + message) {}
62  };
63
64}}} // of namespace utility, yat, and theplu
65
66#endif
Note: See TracBrowser for help on using the repository browser.