You need to sign in to do that
Don't have an account?
Newbie Apex question Capture Error to print friendly message within vf page
I am creating a visualforce page on the developer version of sites. I have created some custom validation within sf that checks for a specific email suffix for a specific recordtype which works well within sf.
However for my visualforce application page entering the wrong email address results in the page crashing and me receiving an email error message as follows when I should receive a friendly error message "you have entered the wrong email address please type a valid email address". Is there a way to capture this error message and do something useful with the page?
Apex script unhandled exception by user/organization: 00580000001jpKb/00D8000099900at5z
Visualforce Page: /pagename/apex/apply_OxUni
System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, You must Enter a valid University of Oxford email address for your applicant: [Email]
Class.appExtension.save: line 77, column 13 External entry point
Debug Log:
***Begining Page Log for /apex/apply_OxUni
Hi this is what I am trying to do capture the error message in the Apex, but i cant find a way to return error messge to the vf page and stop the exection of the apex code.i have tried reading the developer documentation but to no avail.
Including <apex:pageMessages/> in your Apex tags will probably prevent the page from crashing.
and display the objectionable error message.
Look to the documentation for this tag for info on creating your own customizations.