Skip to content

Commit 831c8a1

Browse files
Better handling of the errors
1 parent 3e447a5 commit 831c8a1

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

include/rfl/Result.hpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,9 +458,14 @@ class std::bad_expected_access<rfl::Error> : public bad_expected_access<void> {
458458

459459
const char* what() const noexcept override { return err_.what().c_str(); }
460460

461-
[[nodiscard]]
462-
auto error() const noexcept {
463-
return err_;
461+
[[nodiscard]] rfl::Error& error() & noexcept { return err_; }
462+
463+
[[nodiscard]] const rfl::Error& error() const& noexcept { return err_; }
464+
465+
[[nodiscard]] rfl::Error&& error() && noexcept { return std::move(err_); }
466+
467+
[[nodiscard]] const rfl::Error&& error() const&& noexcept {
468+
return std::move(err_);
464469
}
465470

466471
private:

0 commit comments

Comments
 (0)