I've noticed that uncaught custom exceptions in managed packages aren't recorded in the debug log if it's thrown in the context of the Salesforce UI or Lightning community. The exception message can be seen in the Salesforce UI and in the Lightning community (by retrieving the message from the error object after a server-side call). However, if the custom exception is invoked directly from the dev console by via anonymous apex, it's recorded in the debug log. This seems to be a bug of the Salesforce platform. Is there a workaround for this other than using a custom object for logging errors?

  • you can send uncaught apex exceptions to an email address in Setup - and then consume with an inbound email handler – cropredy Sep 18 '17 at 22:38
  • Are you saying that the debug log showing at all for the Lightning Community requests, or that the log is appearing but specifically lacks the exception details? To get the debug log you probably need to set a browser cookie – Daniel Ballinger Sep 19 '17 at 2:33
  • @DanielBallinger I'm accessing the lightning community as a admin, not a guest. The exception message appears in my development where I created the managed package. However, the exception message doesn't appear in debug logs in the org where I've installed the managed package. – YXY Sep 19 '17 at 17:27
  • @YXY. It's likely part of the managed package IP protections. Salesforce prevents certain things from coming out of the package in the subscriber org. Do you have access to the LMA application? If so, you can use that to see the complete log. – Daniel Ballinger Sep 19 '17 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.