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
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
You get a generic exception page when you create a community.
User receives following error if there occurred any exception while working with communities.
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
Set Use custom Visualforce error pages to True from Site Administration and hit Save
Method 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.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0