Breeze 捕获entity.entityAspect.entityManager.createEntity的错误

Breeze 捕获entity.entityAspect.entityManager.createEntity的错误,breeze,Breeze,当我在代码下面运行时- this.entity.entityAspect.entityManager.createEntity('TblReceipt', { ReceiptNo : 123 .... }); 代码第一次运行正常并创建新实体。现在,当用户尝试再次运行它时,会出现下面的错误- Uncaught Error: A MergeStrategy of 'Disallowed' does not allow you to attach an entity when an

当我在代码下面运行时-

this.entity.entityAspect.entityManager.createEntity('TblReceipt', {

ReceiptNo : 123
....
});
代码第一次运行正常并创建新实体。现在,当用户尝试再次运行它时,会出现下面的错误-

   Uncaught Error: A MergeStrategy of 'Disallowed' does not allow you to attach     an entity when an entity with the same key is already attached"
上面的错误显示在控制台中。如何在javascript代码中捕获此错误并向用户显示消息


谢谢

是的,我知道了。把它们包在试抓块里-

try {

}
Catch(error)
{

}