2023-05-18 18:17:19 +02:00
|
|
|
|
#pragma once
|
|
|
|
|
|
2023-05-28 13:42:36 +02:00
|
|
|
|
#include "global.h"
|
2023-08-21 18:56:45 +02:00
|
|
|
|
#include "SqlErrorCategory.h"
|
2023-05-28 13:42:36 +02:00
|
|
|
|
|
2023-05-18 18:17:19 +02:00
|
|
|
|
#include <string_view>
|
|
|
|
|
#include <string>
|
2023-08-21 18:56:45 +02:00
|
|
|
|
#include <system_error>
|
2023-05-18 18:17:19 +02:00
|
|
|
|
|
|
|
|
|
namespace AsyncPg {
|
|
|
|
|
|
|
|
|
|
/// Ошибка Sql запроса
|
2023-08-21 18:56:45 +02:00
|
|
|
|
class ASYNCPGLIB SqlError : public std::error_code
|
2023-05-18 18:17:19 +02:00
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/// Конструктор класса по умолчанию
|
|
|
|
|
SqlError() = default;
|
|
|
|
|
|
|
|
|
|
/// Конструктор класса
|
2023-08-21 18:56:45 +02:00
|
|
|
|
/// @param code Код ошибки
|
2023-05-18 18:17:19 +02:00
|
|
|
|
/// @param driverError Сообщение об ошибке PostgreSql
|
2023-08-21 18:56:45 +02:00
|
|
|
|
explicit SqlError(ErrorCode code, std::string_view driverError = "");
|
2023-05-18 18:17:19 +02:00
|
|
|
|
|
|
|
|
|
/// Возвращает сообщение об ошибке PostgreSql
|
|
|
|
|
/// @return Сообщение об ошибке PostgreSql
|
|
|
|
|
const std::string& driverMessage() const;
|
|
|
|
|
|
|
|
|
|
/// Очищает ошибку
|
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
std::string _driverMessage;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|