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"
15namespace litesql {
17 class Except : public std::exception {
18private:
19 std::string msg;
20public:
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};
31
32class NotFound : public Except {
33public:
34 NotFound(std::string s="") : Except("NotFound: "+s) {}
35};
36
37class DatabaseError : public Except {
38public:
39 DatabaseError(std::string m) : Except("DatabaseError: "+m) {}
40};
41
42class SQLError : public Except {
43public:
44 SQLError(std::string m) : Except("SQLError: "+m) {}
45};
46
47class InternalError : public Except {
48public:
49 InternalError(std::string m) : Except("InternalError: " +m) {}
50};
51
52class MemoryError : public Except {
53public:
54 MemoryError(std::string m) : Except("Allocation failed: "+m){}
55};
56
57class InsertionError : public Except {
58public:
59 InsertionError(std::string m) : Except("Database full: "+m){}
60};
61
62class UnknownError : public Except {
63 // handles the rest
64public:
65 UnknownError(std::string m) : Except("UnknownError: "+m){}
66};
67
68
69}
70#endif
includes string.hpp and split.hpp

SourceForge.net Logo