Apex コードで例外が発生した際に Apex 例外メール ("Developer script exception" から始まるエラーメール) が届かない場合があります。これは、重複発生した例外の抑制、開発者コンソール上の匿名実行ウィンドウで実行した Apex での例外発生、または 1 時間あたりの送信制限など、製品の動作によるものです。この記事では、Apex 例外メールが送信されない条件について説明します。
Apex 例外メールは、Salesforce 製品の動作により送信されない場合があります。
Apex 例外メールが送信されない主な条件は以下の通りです。
(1) Apex 例外メールの送信は、アプリケーションサーバーごとに 1 時間あたり 10 通に制限されています。この制限は組織 (Org) ごとではないため、特定の組織へのメール配信が常に保証されるわけではありません。
※ アプリケーションサーバーごとの例外メール送信状況を確認する方法はありません。
(2) 開発者コンソールの匿名実行ウィンドウで Apex を実行した際、または @AuraEnabled アノテーションを介して Aura コンポーネントおよび Lightning Web コンポーネントからアクセスされる Apex メソッドで発生した例外では、メールは送信されません。
(3) 同期的または非同期的に実行される Apex コードで重複した例外が発生した場合、後続の例外メールは抑制され、最初のメールのみが送信されます。これは、開発者の受信トレイが同じエラー通知で溢れるのを防ぐための製品動作です。
※ (1) の制限に抵触する場合、最初のメールも送信されません。
Apex 例外メールはデバッグの補助的な手段として意図されており、このように通知が送信されない可能性があることから、確実なエラー通知メカニズムとして利用することはできません。 例外を確実に捕捉・処理するためには、Apex クラス内で try-catch ブロックを使用するなど、適切なエラーハンドリングを実装することが推奨されます。
* Apex の一括処理 (バッチ Apex) においては BatchApexErrorEvent の実装とプラットフォームイベントトリガーを用いることでエラーハンドリングを実施することも可能です。
005227049

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.