diff --git a/cpp/src/arrow/status.cc b/cpp/src/arrow/status.cc index 368e03cac0b..cf3b48b2ee0 100644 --- a/cpp/src/arrow/status.cc +++ b/cpp/src/arrow/status.cc @@ -138,6 +138,16 @@ std::string Status::ToStringWithoutContextLines() const { return message; } +const std::string& Status::message() const { + static const std::string no_message = ""; + return ok() ? no_message : state_->msg; +} + +const std::shared_ptr& Status::detail() const { + static std::shared_ptr no_detail = NULLPTR; + return state_ ? state_->detail : no_detail; +} + void Status::Abort() const { Abort(std::string()); } void Status::Abort(const std::string& message) const { diff --git a/cpp/src/arrow/status.h b/cpp/src/arrow/status.h index ac384fc389a..c6269264cac 100644 --- a/cpp/src/arrow/status.h +++ b/cpp/src/arrow/status.h @@ -329,16 +329,10 @@ class ARROW_EXPORT [[nodiscard]] Status : public util::EqualityComparablecode; } /// \brief Return the specific error message attached to this status. - const std::string& message() const { - static const std::string no_message = ""; - return ok() ? no_message : state_->msg; - } + const std::string& message() const; /// \brief Return the status detail attached to this message. - const std::shared_ptr& detail() const { - static std::shared_ptr no_detail = NULLPTR; - return state_ ? state_->detail : no_detail; - } + const std::shared_ptr& detail() const; /// \brief Return a new Status copying the existing status, but /// updating with the existing detail.