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
Nizam SaifiNizam Saifi 

trigger error message is not showing in lightning interface

I have created a trigger on attachment to prevent user from uploading .CSV file and showing an error message in classic, but when I switched in lightning interface and testing my trigger it is showing standard error message not showing trigger addError() message.

Please share your experience to resolve my problem

 
Veena Sundara-HeraguVeena Sundara-Heragu
Exceptions generated in apex will not show up with all details in lightning.  You need to catch these exceptions in your apex controller and generate an @AuraHandledException which WILL be displayed in lightning.

    @AuraEnabled
    public static void apexMethod( )
    {
        try
        {
            // Your code here
        }
        catch (Exception ex)
        {
            throw new AuraHandledException('Exception occured:\r\n' + ex.getMessage() + '\r\n' + ex.getStackTraceString() + '\r\n');
        }
    }