We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2734
    • 165 Posts
    Hi

    I’m currently developing my second Website using MODx as CMS. So far i’m quite happy with it. Somehow my newly created Site won’t show Exceptions that are thrown by a self developed plugin of mine inside the manager. The other site that uses the same Plugin always showed the Exception on screen and i found a entry in the "System Events" Log. The new site just displays a blank (white) Page inside the "Content" Frame and nothing appears in the Logs.

    Version of MODx is the same for both setups: 0.9.6

    Anybody got a clue why this is happening?
    This issue brings up another question: What is the preferred way to do error-handling in MODx? Are there some API Calls instead of simply throwing an Exception?

    Thanks for reading and best regards
    -- roman



      • 22303 MODX Staff
      • 10,725 Posts
      MODx does not utilize PHP exception handling, because it is an application intended to run on both PHP 4 and 5, whereas exception handling is a feature only available in PHP 5.

      You can look into $modx->messageQuit(), though I hate that one, which stops the parser and displays the canned MODx Parser Error with details, or $modx->sendErrorPage() to have the site automatically forward and produce the page specified in your error_page configuration setting.

      In 0.9.7 there will also be the ability to specify a custom class to be registered in MODx as the PHP error handler, and will include a default implementation. Beyond that, I can envision PHP 5-specific releases with much more robust solutions by way of true exception handling.
        • 2734
        • 165 Posts
        Hi and thanks for your Reply.

        $modx->messageQuit() sounds alright for my purposes.. I just need to locate an error inside the manager.
        Is it possible, that the message won’t appear if i call it on the "OnDocFormSave" Event? I get a blank page whenever i do that... "OnBeforeDocFormSave" seems to work fine though.

        Your future Plans for 0.9.7 sound really promising. Looking forward to it smiley