Changeset View
Standalone View
core/kernel/utility/logger.php
Context not available. | |||||
protected $_ignoreInTrace = Array ('logger.php', 'db_connection.php', 'db_load_balancer.php'); | protected $_ignoreInTrace = Array ('logger.php', 'db_connection.php', 'db_load_balancer.php'); | ||||
/** | /** | ||||
* True when application is going to shutdown. | |||||
* | |||||
* @var boolean | |||||
*/ | |||||
public $applicationShutdown = false; | |||||
alex: Can't apply patch due conflict with current file version. Please sort of re-base. | |||||
/** | |||||
* Create event log | * Create event log | ||||
* | * | ||||
* @param Array $methods_to_call List of invokable kLogger class method with their parameters (if any) | * @param Array $methods_to_call List of invokable kLogger class method with their parameters (if any) | ||||
Context not available. | |||||
*/ | */ | ||||
public function catchLastError() | public function catchLastError() | ||||
{ | { | ||||
$this->applicationShutdown = true; | |||||
$this->write(); | $this->write(); | ||||
$last_error = error_get_last(); | $last_error = error_get_last(); | ||||
Not Done ReplyThe Redirect method you're calling below is already saving session content, so this line isn't needed. alex: The `Redirect` method you're calling below is already saving session content, so this line… | |||||
Not Done ReplyCan't we just call StoreVar method off the Application itself? alex: Can't we just call `StoreVar` method off the `Application` itself? | |||||
Not Done ReplyHere is what needs to be done:
Here is how I was able to the kLogger::catchLastError method:
alex: Here is what needs to be done:
# add `applicationShutdown` property to `kLogger` class, which… | |||||
Not Done ReplyI think we can benefit from using error_fatal.tpl in Admin Console as well, when debug mode is turned off. To make this happen please replace
alex: I think we can benefit from using `error_fatal.tpl` in Admin Console as well, when debug mode… | |||||
Context not available. | |||||
protected function _displayFatalError($errno) | protected function _displayFatalError($errno) | ||||
{ | { | ||||
$errno = $this->_getFatalErrorTitle($errno); | $errno = $this->_getFatalErrorTitle($errno); | ||||
$message = $this->_logger->toString($errno); | |||||
Not Done ReplyThis code will be used when it's Front-End and Debug Mode is Turned Off. In all other cases please use original error reporting code. alex: This code will be used when `it's Front-End` and `Debug Mode is Turned Off`. In all other cases… | |||||
Not Done ReplyWhen we're in admin then use error_fatal as error template and don't read it from system setting to allow Front-End having different template without affecting Admin Console where template name is always the same. alex: When we're in admin then use `error_fatal` as error template and don't read it from system… | |||||
$margin = $this->Application->isAdmin ? '8px' : 'auto'; | if ( PHP_SAPI == 'cli' || $this->_logger->applicationShutdown || $this->Application->isDebugMode(false) ) { | ||||
Not Done ReplyItem 5 of the plan in the Jira issue clearly says that new error display system only takes effect when Debug Mode is turned off. Looks like you entirely replaced old system and that's incorrect. alex: Item 5 of the plan in the Jira issue clearly says that new error display system only takes… | |||||
alexUnsubmitted Not Done ReplyPlease remove the isDebugMode part (let's use nice template in debug mode too). alex: Please remove the `isDebugMode` part (let's use nice template in debug mode too). | |||||
alexUnsubmitted Not Done ReplyActually don't change that line, because we're only getting to _displayFatalError method in debug mode, when debug report is invisible and this happens during ajax request only in which case I want to see failed ajax request instead of redirect. alex: Actually don't change that line, because we're only getting to `_displayFatalError` method in… | |||||
echo '<div style="background-color: #FEFFBF; margin: ' . $margin . '; padding: 10px; border: 2px solid red; text-align: center">' . $this->_logger->toString($errno) . '</div>'; | $css_properties = array( | ||||
exit; | 'background-color: #FEFFBF', | ||||
'margin: ' . ($this->Application->isAdmin ? '8px' : 'auto'), | |||||
'padding: 10px', | |||||
'border: 2px solid red', | |||||
'text-align: center', | |||||
); | |||||
echo '<div style="' . implode('; ', $css_properties) . ';">' . $message . '</div>'; | |||||
exit; | |||||
} | |||||
else { | |||||
$this->Application->StoreVar('FatalErrorMessage', $message); | |||||
Not Done ReplyWhen in CLI:
Idea is to have same error display in CLI as PHP builds it, when it encounters unhandled exception: PHP Fatal error: Uncaught exception 'Exception' with message 'IntuitAnywhere login failed' in /path/to/project/modules/custom/units/helpers/quickbooks/QBConnectorHelper.php:91 Stack trace: #0 /path/to/project/core/kernel/utility/factory.php(118): QBConnectorHelper->Init('QBConnectorHelp...', '', Array) #1 /path/to/project/core/kernel/application.php(2492): kFactory->getObject('QBConnectorHelp...', NULL, Array) #2 /path/to/project/modules/custom/units/helpers/quick_books_helper.php(296): kApplication->recallObject('QBConnectorHelp...') #3 /path/to/project/modules/custom/units/organizations/organization_eh.php(1328): IntechnicQuickBooksHelper->synchronizeVendor(Array) #4 /path/to/project/modules/custom/units/organizations/organization_eh.php(201): OrganizationEventHandler->synchronizeSuppliers(1447405965) #5 /path/to/project/core/kernel/event_handler.php(116): OrganizationEventHandler->OnQuickBooksSynchronize(Object(kEvent)) #6 /mn in /path/to/project/modules/custom/units/helpers/quickbooks/QBConnectorHelper.php on line 91 alex: When in CLI:
# don't append HTML/CSS to the error message
# also show stack trace by using… | |||||
Not Done ReplyPlease don't do it, because we have separate discussion about this at http://community.in-portal.org/x/ZAD3. alex: Please don't do it, because we have separate discussion about this at http://community.in… | |||||
if ( $this->Application->isAdmin ) { | |||||
$this->Application->Redirect('error_fatal'); | |||||
} | |||||
else { | |||||
$this->Application->Redirect($this->Application->ConfigValue('FatalErrorTemplate')); | |||||
} | |||||
alexUnsubmitted Not Done ReplyPlease also do this (for debug mode only):
alex: Please also do this (for debug mode only):
# add the `system-log_id` parameter to redirect… | |||||
} | |||||
Not Done ReplyThis concatenation style doesn't look right. Please to do this instead:
alex: This concatenation style doesn't look right. Please to do this instead:
# create… | |||||
Not Done ReplyTry rearranging code like so:
alex: Try rearranging code like so:
# move `StoreVar` statement on top of outer `else`
# do `… | |||||
} | } | ||||
/** | /** | ||||
Context not available. | |||||
return $res; | return $res; | ||||
} | } | ||||
} | } | ||||
No newline at end of file | |||||
Context not available. |
Can't apply patch due conflict with current file version. Please sort of re-base.