diff --git a/cpp/src/arrow/status.cc b/cpp/src/arrow/status.cc index 8cbc6842c4bc3..55ce3fb78d257 100644 --- a/cpp/src/arrow/status.cc +++ b/cpp/src/arrow/status.cc @@ -141,6 +141,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 853fc284ee317..42e8929ce0b4c 100644 --- a/cpp/src/arrow/status.h +++ b/cpp/src/arrow/status.h @@ -332,16 +332,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.