LiteSQL  0.3.10
except.hpp
Go to the documentation of this file.
1 /* LiteSQL
2  *
3  * The list of contributors at http://litesql.sf.net/
4  *
5  * See LICENSE for copyright information. */
6 
7 #ifndef _litesql_except_hpp
8 #define _litesql_except_hpp
9 #include <iostream>
10 #include <string>
11 #include <exception>
12 #include "litesql/utils.hpp"
15 namespace litesql {
17  class Except : public std::exception {
18 private:
19  std::string msg;
20 public:
21  Except(std::string m) throw() : msg(m) {}
22  virtual ~Except(void) throw() {}
23  virtual const char* what() const throw() {
24  return msg.c_str();
25  }
26  friend std::ostream &operator<<(std::ostream &os, const Except &e) {
27  os << e.msg;
28  return os;
29  }
30 };
32 class NotFound : public Except {
33 public:
34  NotFound(std::string s="") : Except("NotFound: "+s) {}
35 };
37 class DatabaseError : public Except {
38 public:
39  DatabaseError(std::string m) : Except("DatabaseError: "+m) {}
40 };
42 class SQLError : public Except {
43 public:
44  SQLError(std::string m) : Except("SQLError: "+m) {}
45 };
47 class InternalError : public Except {
48 public:
49  InternalError(std::string m) : Except("InternalError: " +m) {}
50 };
52 class MemoryError : public Except {
53 public:
54  MemoryError(std::string m) : Except("Allocation failed: "+m){}
55 };
57 class InsertionError : public Except {
58 public:
59  InsertionError(std::string m) : Except("Database full: "+m){}
60 };
62 class UnknownError : public Except {
63  // handles the rest
64 public:
65  UnknownError(std::string m) : Except("UnknownError: "+m){}
66 };
67 
68 
69 }
70 #endif
Definition: backend.hpp:14
exception thrown when backend cannot allocate memory
Definition: except.hpp:52
includes string.hpp and split.hpp
exception thrown when a record is not found
Definition: except.hpp:32
base class for exceptions
Definition: except.hpp:17
exception thrown when database (disk) is full
Definition: except.hpp:57
exception thrown when backend produces internal error
Definition: except.hpp:47
exception thrown when SQL statement cannot be executed
Definition: except.hpp:42
exception thrown when none of other exceptions match
Definition: except.hpp:62
exception thrown when database cannot be accessed
Definition: except.hpp:37

SourceForge.net Logo