Class: (Custom Exception)
public class CustomException extends Exception {
}
Using as below in my help class:
throw new CustomErrorException('No other characters allowed');
This is working perfectly both from API and UI. But when an exception occurs, it is showing the error message including class name, error line (as shown in below screenshot). However, I would like to display only the error message and omit the other part. As this is custom exception, I cannot use ApexPages.Severity.FATAL
.
Are there any ways to achieve this. Thanks