📄 except.hpp
字号:
/* LiteSQL * * By Tero Laitinen * * See LICENSE for copyright information. */#ifndef _litesql_except_hpp#define _litesql_except_hpp#include <iostream>#include <string>#include "litesql/utils.hpp"/** \file except.hpp contains litesql's exception classes */namespace litesql {/** base class for exceptions */class Except {private: std::string msg;public: Except(std::string m) : msg(m) {} friend std::ostream &operator<<(std::ostream &os, Except &e) { os << e.msg; return os; }};/** exception thrown when a record is not found */ class NotFound : public Except {public: NotFound(std::string s="") : Except("NotFound: "+s) {}};/** exception thrown when database cannot be accessed */class DatabaseError : public Except {public: DatabaseError(std::string m) : Except("DatabaseError: "+m) {}};/** exception thrown when SQL statement cannot be executed */class SQLError : public Except {public: SQLError(std::string m) : Except("SQLError: "+m) {}};/** exception thrown when backend produces internal error */class InternalError : public Except {public: InternalError(std::string m) : Except("InternalError: " +m) {}};/** exception thrown when backend cannot allocate memory */class MemoryError : public Except {public: MemoryError(std::string m) : Except("Allocation failed: "+m){}};/** exception thrown when database (disk) is full */class InsertionError : public Except {public: InsertionError(std::string m) : Except("Database full: "+m){}};/** exception thrown when none of other exceptions match */class UnknownError : public Except { // handles the restpublic: UnknownError(std::string m) : Except("UnknownError: "+m){}};}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -