1#pragma once
2
3/// @file
4/// @brief The error struct returned by the Matrix API.
5
6#include <chrono>
7
8#include "lightweight_error.hpp"
9#include "user_interactive.hpp"
10
11namespace mtx {
12namespace errors {
13//! Represents a Matrix related error.
14struct Error
15{
16 //! Error code.
17 ErrorCode errcode = {};
18 //! Human readable version of the error.
19 std::string error;
20
21 //! Auth flows in case of 401
22 user_interactive::Unauthorized unauthorized;
23
24 //! Retry delay in case of 429
25 std::chrono::duration<std::uint64_t, std::milli> retry_after;
26
27 friend void from_json(const nlohmann::json &obj, Error &error);
28};
29}
30}
31