この文章は Salesforce 機械翻訳システムを使用して翻訳されました。詳細はこちらをご参照ください。
英語に切り替える

aura:systemError

エラーが発生したことを示します。
このイベントは、サーバ側のアクションの実行中にエラーが発生した場合に自動的に起動されます。aura:systemError イベントは、クライアント側のコントローラで処理されます。このイベントを処理するには、コンポーネントに <aura:handler event="aura:systemError"> タグを 1 つだけ指定します。
1swfobject.registerObject("clippy.codeblock-0", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<aura:handler event="aura:systemError" action="{!c.handleError}"/>
次の例に、エラーをトリガするボタンと、aura:systemError イベントのハンドラを示します。
1swfobject.registerObject("clippy.codeblock-1", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<aura:component controller="namespace.myController">
18    <aura:handler event="aura:systemError" action="{!c.showSystemError}"/>
19    <aura:attribute name="response" type="Aura.Action"/>
20    <!-- Other component markup here -->
21    <ui:button aura:id="trigger" label="Trigger error" press="{!c.trigger}"/>
22</aura:component>
次のクライアント側のコントローラは、エラーの起動をトリガし、そのエラーを処理します。
1swfobject.registerObject("clippy.codeblock-2", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17({
18    trigger: function(cmp, event) {
19        // Call an Apex controller that throws an error
20        var action = cmp.get("c.throwError");
21        action.setCallback(cmp, function(response){
22            cmp.set("v.response", response);
23        });
24        $A.enqueueAction(action);
25    },
26
27    showSystemError: function(cmp, event) {
28        // Handle system error
29        $A.log(cmp);
30        $A.log(event);
31    }
32})
aura:systemError ハンドラには、次の必須属性があります。
属性名 説明
event String イベント名。aura:systemError に設定する必要があります。
action Object イベントを処理するクライアント側のコントローラアクション。
aura:systemError イベントには、次の属性があります。event.getParam("message") を使用して属性値を取得できます。
属性名 説明
message String エラーメッセージ。
error String error オブジェクト。