function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

VisualForce pages swallowing errors?

Hi all:


I'm having a problem seeing errors that are arising in my VF pages.


I am using templating, so I have a template, an apex:composition tag, and an apex:define. In my particular case, the header areas of my template come out fine, but one particular apex:define worth of content is never rendered.


I'm sure I know why. Some of the code executed to generate that content is throwing exceptions. In fact I know just what the error is -- some of the getters in the VF code are accessing properties that were never queried for in SOQL -- so I might have {Loan__c.Address} in my VF, but until I add that to my query, the page content just disappears, presumably due to this error.


My problem is, I figured this out by trial and error. I don't know how to see the exception. What I don't understand is why it doesn't appear in the debug log. But in the debug log, execution appears to silently stop when the offending code is hit.


I know how, in a controller, to catch an exception and display it in the page. But this error is happening on a "hard-wired" code path -- I wouldn't even know where to put a try/catch. What I want is for the VF page to show me the error, the way it does in a VF page that I access via a Salesforce URL, that uses a regular SFDC look and feel.


The latter may provide clues -- I am using an entirely custom look, with no pageBlock-style components, and I am accessing the page via Sites. But even when I access it as /apex/<pageName>, I get the same thing -- blank content area with no clue as to error.


I'm sure I'm missing something very simple. Any ideas?

This is a guess without seeing the code....but are you rerendering the portion of the page where <apex:messages/> lives?

Hmm. I'm not, but generally the errors happen after a postback action - after a button's action has been invoked. that generally involves a page shift as opposed to  a refresh. But it's an interesting question -- I'll look at the pages again with that in mind.


-- SGL