--------------------------------------------------------------------------- @function: SOptContext::CloneErrorMsg @doc: Clone m_error_msg to given memory context. Return NULL if there is no error message. ---------------------------------------------------------------------------
| 162 | // |
| 163 | //--------------------------------------------------------------------------- |
| 164 | CHAR * |
| 165 | SOptContext::CloneErrorMsg(MemoryContext context, BOOL *clone_failed) const |
| 166 | { |
| 167 | *clone_failed = false; |
| 168 | |
| 169 | if (nullptr == context || nullptr == m_error_msg) |
| 170 | { |
| 171 | return nullptr; |
| 172 | } |
| 173 | |
| 174 | CHAR *error_msg; |
| 175 | GPOS_TRY |
| 176 | { |
| 177 | #ifdef FAULT_INJECTOR |
| 178 | if (gpdb::InjectFaultInOptTasks("opt_clone_error_msg") == FaultInjectorTypeSkip) |
| 179 | { |
| 180 | GpdbEreport(ERRCODE_INTERNAL_ERROR, ERROR, "Injected error", nullptr); |
| 181 | } |
| 182 | #endif |
| 183 | error_msg = gpdb::MemCtxtStrdup(context, m_error_msg); |
| 184 | } |
| 185 | GPOS_CATCH_EX(ex) |
| 186 | { |
| 187 | error_msg = nullptr; |