diff options
Diffstat (limited to 'nihil/error.cc')
| -rw-r--r-- | nihil/error.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/nihil/error.cc b/nihil/error.cc index de05855..dba3021 100644 --- a/nihil/error.cc +++ b/nihil/error.cc @@ -62,6 +62,14 @@ auto error::cause(this error const &self) -> std::optional<error> return {}; } +auto error::root_cause(this error const &self) -> error const & +{ + if (self.m_cause) + return self.m_cause->root_cause(); + + return self; +} + auto error::str(this error const &self) -> std::string { return self.m_error | match { |
