asyncpg/src/SqlError.h

36 lines
871 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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