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

时间:2015-10-28 22:41:19

标签: 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 entity with the same key is already attached"

上述错误显示在控制台中。如何在javascript代码中捕获此错误并向用户显示消息?

由于

1 个答案:

答案 0 :(得分:0)

是的,是的。只需将它们包装在try catch块中即可 -

WSCredentials