I am using
catch (Exception e){
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.FATAL,'my error msg');
ApexPages.addMessage(myMsg);
}
And have <apex:pageMessages/>
in my VF page.
still i get my custom message + the salesforce standard exception displayed at my page. I want only my message to be shown.
For comment
catch(Exception e){
if(validateVariable.contains('STRING_TOO_LONG') &&
validateVariable.contains('data value too large') ) {
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.FATAL,'Character limit exceeded. Please limit your essay in the prescribed character limit');
ApexPages.addMessage(myMsg);
}
<apex:pageMessages/>
in your VF page<apex:pageMessages/>
tag you are using in your page?