ocpp 0.24.1
A C++ implementation of the Open Charge Point Protocol
database_exceptions.hpp
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2020 - 2023 Pionix GmbH and Contributors to EVerest
3
4#pragma once
5
6#include <exception>
7#include <string>
8
9namespace ocpp::common {
10
12class DatabaseException : public std::exception {
13public:
14 explicit DatabaseException(const std::string& message) : msg(message) {
15 }
16 virtual ~DatabaseException() noexcept {
17 }
18
19 virtual const char* what() const noexcept override {
20 return msg.c_str();
21 }
22
23protected:
24 std::string msg;
25};
26
29public:
30 explicit DatabaseConnectionException(const std::string& message) : DatabaseException(message) {
31 }
32};
33
36public:
37 explicit RequiredEntryNotFoundException(const std::string& message) : DatabaseException(message) {
38 }
39};
40
43public:
44 explicit DatabaseMigrationException(const std::string& message) : DatabaseException(message) {
45 }
46};
47
50public:
51 explicit QueryExecutionException(const std::string& message) : DatabaseException(message) {
52 }
53};
54
55} // namespace ocpp::common
Exception for database connection errors.
Definition: database_exceptions.hpp:28
Base class for database-related exceptions.
Definition: database_exceptions.hpp:12
Exception for errors during database migration.
Definition: database_exceptions.hpp:42
Exception for errors during query execution.
Definition: database_exceptions.hpp:49
Exception that is used if expected table entries are not found.
Definition: database_exceptions.hpp:35