Astarte device API for C++ 0.8.1
Astarte device SDK for C++
Loading...
Searching...
No Matches
astarte::device::ErrorBase Class Reference

Base error class representing any possible error from the Astarte device library. More...

#include <errors.hpp>

+ Inheritance diagram for astarte::device::ErrorBase:

Public Member Functions

virtual ~ErrorBase ()=default
 Destructor for the Astarte error.
 
 ErrorBase (const ErrorBase &)=default
 Default copy constructor.
 
auto operator= (const ErrorBase &) -> ErrorBase &=default
 Default copy assignment operator.
 
 ErrorBase (ErrorBase &&)=delete
 Delete move constructor.
 
auto operator= (ErrorBase &&) -> ErrorBase &=default
 Default move assignment operator.
 
auto message () const -> const std::string &
 Retrieves the error message.
 
auto type () const -> const std::string &
 Retrieves the error type string.
 
auto nested_error () const -> const std::shared_ptr< ErrorBase > &
 Retrieves the nested error, if any.
 

Protected Member Functions

 ErrorBase (std::string_view type, std::string_view message)
 Constructor for the Astarte error.
 
 ErrorBase (std::string_view type, std::string_view message, const ErrorBase &other)
 Wrapping constructor for the Astarte error.
 

Detailed Description

Base error class representing any possible error from the Astarte device library.

Provides the fundamental structure for error reporting, including type identification, human-readable messages, and support for nested (wrapped) errors.

Constructor & Destructor Documentation

◆ ~ErrorBase()

virtual astarte::device::ErrorBase::~ErrorBase ( )
virtualdefault

Destructor for the Astarte error.

◆ ErrorBase() [1/4]

astarte::device::ErrorBase::ErrorBase ( const ErrorBase & )
default

Default copy constructor.

◆ ErrorBase() [2/4]

astarte::device::ErrorBase::ErrorBase ( ErrorBase && )
delete

Delete move constructor.

◆ ErrorBase() [3/4]

astarte::device::ErrorBase::ErrorBase ( std::string_view type,
std::string_view message )
explicitprotected

Constructor for the Astarte error.

Parameters
[in]typeError type name.
[in]messageError message.

◆ ErrorBase() [4/4]

astarte::device::ErrorBase::ErrorBase ( std::string_view type,
std::string_view message,
const ErrorBase & other )
explicitprotected

Wrapping constructor for the Astarte error.

Parameters
[in]typeError type name.
[in]messageError message.
[in]otherNested error to wrap.

Member Function Documentation

◆ message()

auto astarte::device::ErrorBase::message ( ) const -> const std::string &
nodiscard

Retrieves the error message.

Returns
A constant reference to the error message string.

◆ nested_error()

auto astarte::device::ErrorBase::nested_error ( ) const -> const std::shared_ptr< ErrorBase > &
nodiscard

Retrieves the nested error, if any.

Returns
A constant reference to a shared pointer to the nested error, or nullptr if none.

◆ operator=() [1/2]

auto astarte::device::ErrorBase::operator= ( const ErrorBase & ) -> ErrorBase &=default
default

Default copy assignment operator.

Returns
A reference to the assigned class instance.

◆ operator=() [2/2]

auto astarte::device::ErrorBase::operator= ( ErrorBase && ) -> ErrorBase &=default
default

Default move assignment operator.

Returns
A reference to the assigned instance.

◆ type()

auto astarte::device::ErrorBase::type ( ) const -> const std::string &
nodiscard

Retrieves the error type string.

Returns
A constant reference to the error type string.

The documentation for this class was generated from the following file: