xale-db 1.0
minimal SQL engine, written in c++
Loading...
Searching...
No Matches
ExceptionHandler.h
Go to the documentation of this file.
1#ifndef CORE_EXCEPTION_HANDLER_H
2#define CORE_EXCEPTION_HANDLER_H
3
4#include <string>
5#include <exception>
6#include <iostream>
7#include <utility>
8
9namespace Xale::Core
10{
29
33 class DbException : public std::exception
34 {
35 public:
36 DbException(ExceptionCode code, std::string msg, const char* file, int line);
37 const char* what() const noexcept override;
38 ExceptionCode getCode() const;
39
40 private:
41 ExceptionCode _code;
42 std::string _msg;
43 std::string _fullMessage;
44 const char* _file;
45 int _line;
46 };
47}
48
49#define THROW_DB_EXCEPTION(code, msg) \
50 throw Xale::Core::DbException(code, msg, __FILE__, __LINE__)
51
52#endif // CORE_EXCEPTION_HANDLER_H
const char * what() const noexcept override
Definition ExceptionHandler.cpp:17
ExceptionCode getCode() const
Definition ExceptionHandler.cpp:22
DbException(ExceptionCode code, std::string msg, const char *file, int line)
Definition ExceptionHandler.cpp:5
Definition ConfigurationHandler.h:13
ExceptionCode
Enumeration for database exception codes. This should be reviewed and expanded as needed.
Definition ExceptionHandler.h:15
@ WriteFile
Definition ExceptionHandler.h:22
@ Startup
Definition ExceptionHandler.h:18
@ StorageOpen
Definition ExceptionHandler.h:19
@ StorageClose
Definition ExceptionHandler.h:20
@ SyncFile
Definition ExceptionHandler.h:23
@ None
Definition ExceptionHandler.h:16
@ ExecutionError
Definition ExceptionHandler.h:26
@ DataStruct
Definition ExceptionHandler.h:24
@ Unknown
Definition ExceptionHandler.h:17
@ ReadFile
Definition ExceptionHandler.h:21
@ PacketError
Definition ExceptionHandler.h:27
@ ParseError
Definition ExceptionHandler.h:25