Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled exception when email limits are reached #547

Closed
patrick-skamarak opened this issue Sep 15, 2023 · 0 comments · Fixed by #548
Closed

Unhandled exception when email limits are reached #547

patrick-skamarak opened this issue Sep 15, 2023 · 0 comments · Fixed by #548
Assignees
Labels
Feature: Email Notifications Layer: Log Management Items related to the custom objects & Logger Console app Type: Bug Something isn't working

Comments

@patrick-skamarak
Copy link
Contributor

patrick-skamarak commented Sep 15, 2023

From Messaging.reserveSingleEmailCapacity docs:
If the transaction would cause the organization to exceed its daily email limit, using this method results in the following error: System.HandledException: The daily limit for the org would be exceeded by this request.

We recently had an incident where we hit org limits for Events. After that, we reached email limits. Adding a catch for System.HandledException would prevent Logger.saveLog() from halting execution when limits are reached.

private static Boolean IS_EMAIL_DELIVERABILITY_ENABLED {
get {
if (IS_EMAIL_DELIVERABILITY_ENABLED == null) {
try {
System.Messaging.reserveSingleEmailCapacity(1);
System.Messaging.reserveMassEmailCapacity(1);
IS_EMAIL_DELIVERABILITY_ENABLED = true;
} catch (System.NoAccessException e) {
IS_EMAIL_DELIVERABILITY_ENABLED = false;
}
}
return IS_EMAIL_DELIVERABILITY_ENABLED;
}
set;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: Email Notifications Layer: Log Management Items related to the custom objects & Logger Console app Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants