Skip to content

Commit

Permalink
Fixed error handler when executor is not started (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
intuibase authored Feb 5, 2025
1 parent 33fa818 commit 8444568
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions prod/native/extension/code/Hooking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ void elastic_observer_error_cb(int type, zend_string *error_filename, uint32_t e
ELOGF_WARNING(ELASTICAPM_G(globals)->logger_, HOOKS, "elastic_observer_error_cb currentED: %p currentEXception: %p func null, msg: " PRsv, EG(current_execute_data), EG(exception), PRsvArg(msg));
}
}

errorHandling = true;
ELASTICAPM_G(globals)->requestScope_->handleError(type, fileName, error_lineno, msg);
ELASTICAPM_G(globals)->requestScope_->handleError(type, fileName, error_lineno, msg, static_cast<bool>(EG(current_execute_data)));
errorHandling = false;
}

Expand Down
10 changes: 5 additions & 5 deletions prod/native/libcommon/code/RequestScope.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ class RequestScope {
}
}

bool handleError(int type, std::string_view errorFilename, uint32_t errorLineno, std::string_view message) {
ELOGF_DEBUG(log_, REQUEST, "RequestScope::handleError type: %d fn: %s:%d msg: %s", type, errorFilename.data(), errorLineno, message.data());
void handleError(int type, std::string_view errorFilename, uint32_t errorLineno, std::string_view message, bool callPHPHandler) {
ELOGF_DEBUG(log_, REQUEST, "RequestScope::handleError calling handler: %d, type: %d fn: %s:%d msg: %s", callPHPHandler, type, errorFilename.data(), errorLineno, message.data());

bridge_->callPHPSideErrorHandler(type, errorFilename, errorLineno, message);

return false;
if (callPHPHandler) {
bridge_->callPHPSideErrorHandler(type, errorFilename, errorLineno, message);
}
}

bool isFunctional() {
Expand Down

0 comments on commit 8444568

Please sign in to comment.