magento-lts
magento-lts copied to clipboard
Added links to open source files in your IDE when an error occurs
Description
1/ When an exception occurs during cron job, we have something like this (cron messages):
Mage_Core_Exception: Too late for the schedule. in app/Mage.php:653
Stack trace:
#0 app/code/core/Mage/Cron/Model/Observer.php(287): Mage::throwException()
#1 app/code/core/Mage/Cron/Model/Observer.php(60): Mage_Cron_Model_Observer->_processJob()
#2 app/code/core/Mage/Core/Model/App.php(1457): Mage_Cron_Model_Observer->dispatch()
#3 app/code/core/Mage/Core/Model/App.php(1435): Mage_Core_Model_App->_callObserverMethod()
#4 app/Mage.php(507): Mage_Core_Model_App->dispatchEvent()
#5 cron.php(18): Mage::dispatchEvent()
#6 {main}
Now we have:
Mage_Core_Exception: Too late for the schedule.
#0 app/code/core/Mage/Cron/Model/Observer.php(287): Mage::throwException()
#1 app/code/core/Mage/Cron/Model/Observer.php(60): Mage_Cron_Model_Observer->_processJob()
#2 app/code/core/Mage/Core/Model/App.php(1457): Mage_Cron_Model_Observer->dispatch()
#3 app/code/core/Mage/Core/Model/App.php(1435): Mage_Core_Model_App->_callObserverMethod()
#4 app/Mage.php(507): Mage_Core_Model_App->dispatchEvent()
#5 cron.php(18): Mage::dispatchEvent()
#6 {main}
thrown in app/Mage.php on line 653
2/ When an exception occurs on frontend, we have something like this (dev mode enabled):
Invalid method Mage_Core_Model_Store::code(Array())
#0 app/code/core/Mage/Catalog/controllers/Seo/SitemapController.php(30): Varien_Object->__call()
#1 app/code/core/Mage/.../Action.php(410): Mage_Catalog_Seo_SitemapController->preDispatch()
#2 app/code/core/Mage/.../Router/Standard.php(255): Mage_Core_Controller_Varien_Action->dispatch()
#3 app/code/core/Mage/.../Front.php(181): Mage_Core_Controller_Varien_Router_Standard->match()
#4 app/code/core/Mage/Core/Model/App.php(358): Mage_Core_Controller_Varien_Front->dispatch()
#5 app/Mage.php(743): Mage_Core_Model_App->run()
#6 index.php(56): Mage::run()
#7 {main}
Now we have:
Varien_Exception: Invalid method Mage_Core_Model_Store::code(Array())
#0 app/code/core/Mage/Catalog/controllers/Seo/SitemapController.php(30): Varien_Object->__call()
#1 app/code/core/Mage/.../Action.php(410): Mage_Catalog_Seo_SitemapController->preDispatch()
#2 app/code/core/Mage/.../Router/Standard.php(255): Mage_Core_Controller_Varien_Action->dispatch()
#3 app/code/core/Mage/.../Front.php(181): Mage_Core_Controller_Varien_Router_Standard->match()
#4 app/code/core/Mage/Core/Model/App.php(358): Mage_Core_Controller_Varien_Front->dispatch()
#5 app/Mage.php(743): Mage_Core_Model_App->run()
#6 index.php(56): Mage::run()
#7 {main}
thrown in lib/Varien/Object.php on line 636
3/ When an exception occurs on frontend, we have something like this (dev mode enabled + error_reporting(E_ALL)):
Deprecated functionality: Function libxml_disable_entity_loader() is deprecated
in app/code/core/Mage/Catalog/controllers/Seo/SitemapController.php on line 31
#0 app/code/core/Mage/Catalog/controllers/Seo/SitemapController.php(31): mageCoreErrorHandler()
#1 app/code/core/Mage/.../Action.php(410): Mage_Catalog_Seo_SitemapController->preDispatch()
#2 app/code/core/Mage/.../Router/Standard.php(255): Mage_Core_Controller_Varien_Action->dispatch()
#3 app/code/core/Mage/.../Front.php(181): Mage_Core_Controller_Varien_Router_Standard->match()
#4 app/code/core/Mage/Core/Model/App.php(358): Mage_Core_Controller_Varien_Front->dispatch()
#5 app/Mage.php(744): Mage_Core_Model_App->run()
#6 index.php(56): Mage::run()
#7 {main}
Now we have:
ErrorException: Deprecated functionality Function libxml_disable_entity_loader() is deprecated
#0 app/code/core/Mage/Catalog/controllers/Seo/SitemapController.php(31): mageCoreErrorHandler()
#1 app/code/core/Mage/.../Action.php(410): Mage_Catalog_Seo_SitemapController->preDispatch()
#2 app/code/core/Mage/.../Router/Standard.php(255): Mage_Core_Controller_Varien_Action->dispatch()
#3 app/code/core/Mage/.../Front.php(181): Mage_Core_Controller_Varien_Router_Standard->match()
#4 app/code/core/Mage/Core/Model/App.php(358): Mage_Core_Controller_Varien_Front->dispatch()
#5 app/Mage.php(744): Mage_Core_Model_App->run()
#6 index.php(56): Mage::run()
#7 {main}
thrown in app/code/core/Mage/Catalog/controllers/Seo/SitemapController.php on line 31
Not sure if all exception cases are covered here.
New features
- HTML is not displayed on CLI
- you are using VSCode? add
MAGE_VSCODE_LINKSlikeMAGE_IS_DEVELOPER_MODEto display links - you are using PHPStorm? add
MAGE_PHPSTORM_LINKSlikeMAGE_IS_DEVELOPER_MODEto display links - you are using OpenFileEditor? add
MAGE_OPENFILEEDITOR_LINKSlikeMAGE_IS_DEVELOPER_MODEto "display links" - also available for "Template Path Hints" and associated "Block Names"
Contribution checklist
- [x] Pull request has a meaningful description of its purpose
- [x] All commits are accompanied by meaningful commit messages
- [x] All automated tests passed successfully (all builds are green)
- [x] Add yourself to contributors list
With body tag and some styles attributes, we can put Jacky in his car!
Isn't the PR title very different from what it actually does? or am I missing something?
Yes, the title is wrong, there are more.
I also forgot to add static for anonymous functions.
Do I need to add MAGE_OPENFILEEDITOR_LINKS for invisible <span>?
For vscode I found this link: https://code.visualstudio.com/docs/editor/command-line#_opening-vs-code-with-urls from https://stackoverflow.com/q/53140692/2980105 with interesting point for Symfony
For phpstorm, unsure, I found this link: https://stackoverflow.com/q/65879371/2980105 but...
Please split better error messages and editor urls.
(btw ... how about ONE env varibale? EDITOR_URL=<vscode|phpstorm|whatever>)
Another idea: how about system configurable in the Developer tab. Easier to enable/disable, and choose from a dropdown list of supported IDEs?
Another idea: how about system configurable in the Developer tab. Easier to enable/disable, and choose from a dropdown list of supported IDEs?
I wrote a similar comment a few days ago but apparently forgot to submit it. I agree with the above, using a config is a lot easier.
No you can't, there is a minimum amount of code in Mage::printException and in errors/processor.php, we can't add Mage::getStoreConfig here.
For only ONE variable, yes, but, there are two formats: #2 abc.php(10) + thrown in abc.php on line 653
(btw ... how about ONE env varibale?
EDITOR_URL=<vscode|phpstorm|whatever>)
I'd also prefer a single environment variable, actually I'd prefer it compared to a configuration setting
Oh yes, I can use EDITOR_URL. But later, the Oksfjordjoekelen is waiting me!