0
コンポーネントからエラーをスローするための最良の方法は何ですか?次の例では、アクションが渡されているかどうかをチェックして、これをさらに実行しないようにエラーをスローしますが、エラールートは期待どおりにトリガーされません。エバーコンポーネントでのスローエラー
/**
* Save step and go to the next step.
*/
next() {
if (isEmpty(this.get('nextAction'))) {
throw new Error('The nextAction is undefined.');
}
if (isEmpty(this.get('saveAction'))) {
throw new Error('The saveAction is undefined.');
}
const insuranceApplication = this.get('model');
if (this.isLastDependent(this.get('dependentIndex'), insuranceApplication.get('dependents.length'))) {
return this.get('nextAction')();
}
return this.get('saveAction')().then(() => {
this.set('dependent', this.getNextDependent(insuranceApplication.get('dependents')));
});
}