You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libexopt/include/error.hh

32 lines
846 B

#pragma once
#include "exopt.h"
#include "optional.h"
#include "util.hh"
namespace exopt {
class Report {
virtual ~Report();
};
class Error {
constexpr Error() = default;
constexpr Error(Error const&) = default;
constexpr Error(Error &&) = default;
constexpr Error& operator=(Error &&) = default;
constexpr Error& operator=(Error const&) = default;
constexpr virtual std::string_view message() const noexcept =0;
constexpr virtual MaybeOwnedRef<Error> inner() noexcept { return {}; } //TODO: Maybe just use `std::optional<std::reference_wrapper<Error>>`
constexpr virtual MaybeOwned<Report> into_report() noexcept { /* TODO */ } // XXX: ^^
constexpr virtual MaybeOwned<Report> into_report() && noexcept { /* TODO: auto{*this}.into_report() */ }
constexpr virtual ~Error() = default;
protected:
private:
};
}