MCPcopy Create free account
hub / github.com/apache/arrow / StopIfNotOk

Function StopIfNotOk

r/src/arrow_types.h:99–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99static inline void StopIfNotOk(const Status& status) {
100 if (!status.ok()) {
101 auto detail = status.detail();
102 const UnwindProtectDetail* unwind_detail =
103 dynamic_cast<const UnwindProtectDetail*>(detail.get());
104 if (unwind_detail) {
105 throw cpp11::unwind_exception(unwind_detail->token);
106 } else {
107 // We need to translate this to "native" encoding for the error to be
108 // displayed properly using cpp11::stop()
109 std::string s = status.ToString();
110 cpp11::strings s_utf8 = cpp11::as_sexp(s);
111 const char* s_native = cpp11::safe[Rf_translateChar](s_utf8[0]);
112
113 // ARROW-13039: be careful not to interpret our error message as a %-format string
114 cpp11::stop("%s", s_native);
115 }
116 }
117}
118
119template <typename R>
120auto ValueOrStop(R&& result) -> decltype(std::forward<R>(result).ValueOrDie()) {

Callers 15

ValueOrStopFunction · 0.85
ExecPlan_runFunction · 0.85
ExecPlan_WriteFunction · 0.85
ExecPlan_run_substraitFunction · 0.85
csv___WriteCSV__TableFunction · 0.85
ConvertMethod · 0.85
CreateEmptyArrayFunction · 0.85
Converter_DictionaryMethod · 0.85
Ingest_all_nullsMethod · 0.85
Ingest_some_nullsMethod · 0.85

Calls 5

as_sexpFunction · 0.85
stopFunction · 0.85
okMethod · 0.45
getMethod · 0.45
ToStringMethod · 0.45

Tested by 1

TestSafeCallIntoRFunction · 0.68