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
Ross.ax1563Ross.ax1563 

Error Method for Entire Class

Goodday

 

Is it possible to define an error method for an entire Apex class? 

 

Many thanks

Ross

MagulanDuraipandianMagulanDuraipandian

http://infallibletechie.blogspot.in/2012/10/how-to-display-error-messages-in.html

 

Check this...

 

Regards,

Magulan D

Salesforce.com certified Force.com Developer.

SFDC Blog

SFDC Site

If this post is your solution, kindly mark this as the solution and give Kudos.

ngabraningabrani

I am not completely clear what you are trying to do.

 

You could potentially have a method which takes "Error Message" as input, and invokes the following method 

 

ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Error Message.');

 

It may also have a System.Debug message to print the error.

 

Every where in the code (controller) we can then call this method to print messages, instead of calling ApexPages.Message. 

Ross.ax1563Ross.ax1563

No, I am basically trying to catch the entire class and pass the exception to a method liek this (pseudocode):-

 

try {

    theclass

}

catch (exception E){

     myerrorhandler(E);

}