1

I am facing a vf page exception while logging into community with a couple of users. It works with other users. The only exception that I am able to see is VF: /apex/Exception. Nothing else is shown. I already set up trace flag with the user I am logging in to community. Is there any other way to debug the vf page.

23:03:19.0 (29787899)|VF_EVALUATE_FORMULA_END
23:03:19.0 (29793681)|VF_EVALUATE_FORMULA_BEGIN|06631000004Zwup|#
{NOT(ISPICKVAL($User.UserType,'Guest'))}
23:03:19.0 (29809758)|VF_EVALUATE_FORMULA_END
23:03:19.30 (30840830)|CUMULATIVE_LIMIT_USAGE
23:03:19.30 (30840830)|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

23:03:19.30 (30840830)|TOTAL_EMAIL_RECIPIENTS_QUEUED|0
23:03:19.30 (30840830)|CUMULATIVE_LIMIT_USAGE_END

***23:03:19.0 (30905948)|CODE_UNIT_FINISHED|VF: /apex/Exception***
23:03:19.0 (31757330)|EXECUTION_FINISHED
23:03:19.32 (32709561)|CUMULATIVE_PROFILING_BEGIN
23:03:19.32 (32709561)|CUMULATIVE_PROFILING|No profiling information for SOQL operations
23:03:19.32 (32709561)|CUMULATIVE_PROFILING|No profiling information for SOSL operations
23:03:19.32 (32709561)|CUMULATIVE_PROFILING|No profiling information for DML operations
23:03:19.32 (32709561)|CUMULATIVE_PROFILING|No profiling information for method invocations
23:03:19.32 (32709561)|CUMULATIVE_PROFILING_END
  • is this a custom exception page you designed ? – Nachiket Deshpande Jan 9 '18 at 7:20
  • this is the custom vf page used in community. The logged in user is getting the typical error "Error: Error occurred while loading a Visualforce page." – Jigar Trivedi Jan 9 '18 at 7:34
2

You get a generic exception page when you create a community. User receives following error if there occurred any exception while working with communities. enter image description here

Two options available on Force.com sites which gives the exact reason the particular error has pop-up are

$Site.ErrorMessage : Returns an error message for the current page if it’s a designated error page for the site and an error exists; otherwise, returns an empty string.
$Site.ErrorDescription : Returns an error message for the current page if it’s a designated error page for the site and an error exists; otherwise, returns an empty string.
Ref : $Site

There is page available for your community named "Exception.Page" , (you can easily get this if you will look into your source code - inside pages folder) inside that look for this code:

<apex:outputText styleClass="title" value="{!$Label.site.error}">
     <apex:param value="{!$Site.ErrorMessage}"/>
     <!-- this parameter needs to be italic in the site.error label --> 
</apex:outputText>

you can see that there is this parameter for error message

<apex:param value="{!$Site.ErrorMessage}"/>

so change this from value="{!$Site.ErrorMessage}" to value="{!$Site.ErrorDescription}"

Also if you want to design your own custom exception page to display error, you can take a look to my blog post here
Error occurred while loading a Visualforce page

VisualforcePage : CustomErrorPage

<apex:page action="{!yourPageLevelAction}" controller="YourController" >
   <apex:outputText styleClass="title" value="{!failingPageResponse}">   </apex:outputText>
</apex:page>

Controller : YourController

public  class YourController {
    //Variable Declaration
    public String failingPageResponse { get; set; }

    public PageReference yourPageLevelAction()
   {
      failingPageResponse = Site.getErrorDescription();
      return null;
    }//yourPageLevelAction
}//YourController

Replace CustomErrorPage with standard Force.com site error pages
Go to the site that you have created in your org and click on the label of that site and follow the steps mentioned following.

Ref : Assigning Force.com Site Error Pages

Page Assignment
enter image description here

Set Use custom Visualforce error pages to True from Site Administration and hit Save

enter image description here

2

From Spring 18 you no longer need cookies to set debug log for guest user.

Collect Debug Logs for Guest Users Without Setting Cookies

In your exception age you will see one line

<apex:param value="{!$Site.ErrorMessage}"/>

change this into

<apex:param value="{!$Site.ErrorDescription}"/>

You will get the error on detail page.

  • I have no line like this in my page. – Jigar Trivedi Jan 9 '18 at 8:45
  • Good to know, but presumably Jigar is running Winter '18? – Keith C Jan 9 '18 at 8:58
  • Yes, Winter '18. – Jigar Trivedi Jan 9 '18 at 9:01
  • Thanks Tushar. But, I was unable to understand which page you were talking about. – Jigar Trivedi Jan 9 '18 at 9:11
  • 1
    Yes, I got that in Nachiket's answer. Thanks for the help! – Jigar Trivedi Jan 9 '18 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.