Added TODO: For lean build, complete error framework and work on ergonomic `constinit` ruleset definition (see TODO for info on possible implementation.)
Fortune for libexopt's current commit: Small blessing − 小吉lean
parent
3bdd503cb2
commit
6e11ff88a5
@ -0,0 +1,9 @@
|
||||
TODO: Remove all this bullshit like rng.h, keep pointer, current boxed, and util; keep the error stuff and get a consistent framework for it but then work on the ruleset, rule definitions, making it ergonomic and `constinit`, etc. The actual real reason this project exists...
|
||||
Then add things like `iterator<T>` to use for parsing, and `argument_{input/output}_stream` for transformations, etc. See notes on phone for custom handlers as well. Use as much aggregate (POD) init as possible, e.g:
|
||||
|
||||
```
|
||||
// with rule ctor for `<size_t DN>(char8_t, const char &(desc)[DN], kind, attribute = {})`
|
||||
// ...
|
||||
{ 'v', "Increase verbosity" , kind::Switch, { .allow_multuple = 3 }},
|
||||
// ...
|
||||
```
|
@ -0,0 +1,30 @@
|
||||
#include <stdexcept>
|
||||
|
||||
#include <error.hh>
|
||||
|
||||
using namespace exopt::types;
|
||||
|
||||
namespace exopt {
|
||||
Box<TracedError> Error::into_traced(std::stacktrace&& trace) &&noexcept {
|
||||
struct DynamicTracedError final : TracedError {
|
||||
_EO_CTORS_BASIC_DEFAULT(DynamicTracedError, _EO_NOTHING, noexcept);
|
||||
virtual ~DynamicTracedError() noexcept = default;
|
||||
|
||||
DynamicTracedError(Error&& self, std::stacktrace&& trace) noexcept
|
||||
: TracedError(std::move(trace), std::move(self.m_location))
|
||||
, m_error(std::move(self)) {}
|
||||
|
||||
std::string_view message() const noexcept override { return m_error->message(); }
|
||||
Option<Error const&> inner() const noexcept override { return Option<Error const&>(*m_error); }//{ return Option<Error const&>::from_pointer(std::as_const(m_error.get())); }
|
||||
MaybeOwned<Report> into_report() && noexcept override { return std::move(*m_error).into_report(); }
|
||||
MaybeOwned<Report> into_report() & noexcept override { return m_error->into_report(); }
|
||||
|
||||
|
||||
private:
|
||||
Box<Error> m_error;
|
||||
};
|
||||
#define ERR DynamicTracedError{std::move(*this), std::move(trace)}
|
||||
return Box<TracedError>::template new_dynamic<DynamicTracedError, false>(ERR);
|
||||
#undef ERR
|
||||
}
|
||||
}
|
Loading…
Reference in new issue