Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cpp/src/arrow/status.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<StatusDetail>& Status::detail() const {
static std::shared_ptr<StatusDetail> no_detail = NULLPTR;
return state_ ? state_->detail : no_detail;
}

void Status::Abort() const { Abort(std::string()); }

void Status::Abort(const std::string& message) const {
Expand Down
10 changes: 2 additions & 8 deletions cpp/src/arrow/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,16 +329,10 @@ class ARROW_EXPORT [[nodiscard]] Status : public util::EqualityComparable<Status
constexpr StatusCode code() const { return ok() ? StatusCode::OK : state_->code; }

/// \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<StatusDetail>& detail() const {
static std::shared_ptr<StatusDetail> no_detail = NULLPTR;
return state_ ? state_->detail : no_detail;
}
const std::shared_ptr<StatusDetail>& detail() const;

/// \brief Return a new Status copying the existing status, but
/// updating with the existing detail.
Expand Down
Loading