relx 0.1.0
A Modern C++23 Type-Safe SQL Query Builder
Loading...
Searching...
No Matches
error_handling.hpp File Reference
#include "../connection/connection.hpp"
#include "../query/core.hpp"
#include "../results/result.hpp"
#include <expected>
#include <format>
#include <source_location>
#include <stdexcept>
#include <string>

Go to the source code of this file.

Classes

class  relx::RelxException
 Base exception class for relx errors. More...
 

Namespaces

namespace  relx
 relx database connection
 

Functions

std::string relx::format_error (const connection::ConnectionError &error)
 Format a ConnectionError for exception messages.
 
std::string relx::format_error (const query::QueryError &error)
 Format a QueryError for exception messages.
 
std::string relx::format_error (const result::ResultError &error)
 Format a ResultError for exception messages.
 
template<typename T , typename E >
T & relx::value_or_throw (std::expected< T, E > &result, const std::string &context="", const std::source_location &location=std::source_location::current())
 Function to extract a value from an expected or throw on error.
 
template<typename T , typename E >
relx::value_or_throw (std::expected< T, E > &&result, const std::string &context="", const std::source_location &location=std::source_location::current())
 Overload for rvalue std::expected.
 
template<typename E >
void relx::throw_if_failed (const std::expected< void, E > &result, const std::string &context="", const std::source_location &location=std::source_location::current())
 Function to check and throw on error with no return value.