Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何查看breeze客户端验证错误_Breeze_Hottowel - Fatal编程技术网

如何查看breeze客户端验证错误

如何查看breeze客户端验证错误,breeze,hottowel,Breeze,Hottowel,我已经阅读了breeze验证器信息,但不确定如何查看正在发生的实际错误 错误:遇到客户端验证错误-有关详细信息,请参阅此对象上的entity errors集合 我相信它在entity.entityAspect.getValidationErrors()中的某个地方,但我很难弄清楚如何从中找出实际的错误 出现此错误消息时,我试图将记录插入实体并保存更改。请参阅: 简单的例子: var errors = entity.entityAspect.getValidationErrors(); err

我已经阅读了breeze验证器信息,但不确定如何查看正在发生的实际错误

错误:遇到客户端验证错误-有关详细信息,请参阅此对象上的entity errors集合

我相信它在entity.entityAspect.getValidationErrors()中的某个地方,但我很难弄清楚如何从中找出实际的错误

出现此错误消息时,我试图将记录插入实体并保存更改。

请参阅:

简单的例子:

var errors = entity.entityAspect.getValidationErrors();
errors.forEach(function(ve) {
   var errorMessage = ve.errorMessage;
   var property = ve.property;
});
要获取EntityManager中的所有错误,可以使用

manager.getEntities().forEach(function(entity) { 
   var errors = entity.entityAspect.getValidationErrors();
   //.. do something with the errors ..
});

您可以在尝试保存时“捕获”错误,如下所示:

manager.saveChanges()
  .catch(function(error){
      console.log("error catch", error, error.entityErrors);
  });
请记住,之后的任何代码都需要在

setTimeout(function() {}, 0);
因为捕获是异步的。
这是因为你不需要遍历应用程序中的所有实体就可以找到有错误的实体。

我以前已经研究过了。getValidationErrors始终返回为无法调用未定义的方法“getValidationErrors”:manager=configureBreezeManager();manager.entityAspect.getValidationErrors()请查看Breeze zip中DocCode示例中的验证示例。但只要看看您的评论,EntityManager没有“entityAspect”属性,实体本身都有一个“entityAspect”属性。因此,如果您想要entityManager中的所有错误,请使用manager.getEntities().forEach(函数(ent){var errors=ent.entityAspect.getValidationErrors());