如何更改在composer-rest-server中返回的错误消息?

时间:2018-12-10 20:05:38

标签: hyperledger-fabric hyperledger hyperledger-composer

在智能合约中,我添加了一些检查,例如:

      // Check if user owns the property
  if(submittedOwnerId !== actualOwnerId){
    // If they are not the owner, give error and quit
    throw new Error('You do not own this property'); 
  }

在Composer Playground中,这样返回错误:

Error: You do not own this property

但是在composer-rest-server中,错误返回如下: Error currently being returned:

我想知道composer-rest-server中是否有一个设置,我只能简单地返回实际的错误消息,例如在Composer Playground中返回的错误消息。

1 个答案:

答案 0 :(得分:1)

否,无法通过设置更改在composer-rest-server中返回的消息。之所以在composer-playground中看到如此简单的输出,是因为您正在使用Web浏览器连接器,该连接器提供了一个非常简单的环境的模拟,因此代码路径与通过游乐场或其余部分连接到实际结构不同。服务器。如果您使用游乐场连接到真实结构,则将看到与composer-rest-server类似的消息。