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
Stefaan Somers 11Stefaan Somers 11 

Raise BatchApexErrorEvent for queueable or scheduled classes

For Batchable classes you can extend it with Database.RaisesPlatformEvents so BatchApexErrorEvent is raised in case of errors.

Can we do something similar for Queueable or Scheduled classes. I tried to create BatchApexErrorEvent itself but apparently field Message is not writable....
AshwiniAshwini (Salesforce Developers) 
Hi Stefaan,
You can catch the exceptions and publish your own PlatformEvents "manually".Example of things that do this are logger frameworks like Nebula(https://github.com/jongpie/NebulaLogger) and the one bobbywhitesfdc wrote i.ehttps://github.com/bobbywhitesfdc/LoggingFramework 

Thanks.