Lutok  0.2
 All Classes Namespaces Files Functions Variables Defines
exceptions.hpp
Go to the documentation of this file.
00001 // Copyright 2011 Google Inc.
00002 // All rights reserved.
00003 //
00004 // Redistribution and use in source and binary forms, with or without
00005 // modification, are permitted provided that the following conditions are
00006 // met:
00007 //
00008 // * Redistributions of source code must retain the above copyright
00009 //   notice, this list of conditions and the following disclaimer.
00010 // * Redistributions in binary form must reproduce the above copyright
00011 //   notice, this list of conditions and the following disclaimer in the
00012 //   documentation and/or other materials provided with the distribution.
00013 // * Neither the name of Google Inc. nor the names of its contributors
00014 //   may be used to endorse or promote products derived from this software
00015 //   without specific prior written permission.
00016 //
00017 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00018 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00019 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00020 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00021 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00022 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00023 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00024 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00025 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00026 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00027 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00028 
00031 
00032 #if !defined(LUTOK_EXCEPTIONS_HPP)
00033 #define LUTOK_EXCEPTIONS_HPP
00034 
00035 #include <stdexcept>
00036 #include <string>
00037 
00038 namespace lutok {
00039 
00040 
00041 class state;
00042 
00043 
00045 class error : public std::runtime_error {
00046 public:
00047     explicit error(const std::string&);
00048     virtual ~error(void) throw();
00049 };
00050 
00051 
00053 class api_error : public error {
00055     std::string _api_function;
00056 
00057 public:
00058     explicit api_error(const std::string&, const std::string&);
00059     virtual ~api_error(void) throw();
00060 
00061     static api_error from_stack(state&, const std::string&);
00062 
00063     const std::string& api_function(void) const;
00064 };
00065 
00066 
00068 class file_not_found_error : public error {
00070     std::string _filename;
00071 
00072 public:
00073     explicit file_not_found_error(const std::string&);
00074     virtual ~file_not_found_error(void) throw();
00075 
00076     const std::string& filename(void) const;
00077 };
00078 
00079 
00080 }  // namespace lutok
00081 
00082 
00083 #endif  // !defined(LUTOK_EXCEPTIONS_HPP)