Как вернуть настроенное сообщение об ошибке через loopback-api? - PullRequest
0 голосов
/ 02 апреля 2019

проблема в том, что ошибка приходит в определенном формате и не на простом языке.

это то, что я получаю:

{
  "error": {
    "statusCode": 500,
    "name": "Error",
    "message": "Invalid JSON data. Found a value that is not a string: 1111 for relationship RelationshipDeclaration {name=asset, type=org.example.mynetwork.SampleAsset, array=false, optional=false}",
    "stack": "Error: Invalid JSON data. Found a value that is not a string: 1111 for relationship RelationshipDeclaration {name=asset, type=org.example.mynetwork.SampleAsset, array=false, optional=false}\n    at JSONPopulator.visitRelationshipDeclaration (/home/avinash/modi/sample-network/my-loopback/node_modules/composer-common/lib/serializer/jsonpopulator.js:293:27)\n    at JSONPopulator.visit (/home/avinash/modi/sample-network/my-loopback/node_modules/composer-common/lib/serializer/jsonpopulator.js:102:25)\n    at RelationshipDeclaration.accept (/home/avinash/modi/sample-network/my-loopback/node_modules/composer-common/lib/introspect/decorated.js:65:24)\n    at JSONPopulator.visitClassDeclaration (/home/avinash/modi/sample-network/my-loopback/node_modules/composer-common/lib/serializer/jsonpopulator.js:128:51)\n    at JSONPopulator.visit (/home/avinash/modi/sample-network/my-loopback/node_modules/composer-common/lib/serializer/jsonpopulator.js:100:25)\n    at TransactionDeclaration.accept (/home/avinash/modi/sample-network/my-loopback/node_modules/composer-common/lib/introspect/decorated.js:65:24)\n    at Serializer.fromJSON (/home/avinash/modi/sample-network/my-loopback/node_modules/composer-common/lib/serializer.js:203:26)\n    at ensureConnected.then (/home/avinash/modi/sample-network/my-loopback/node_modules/loopback-connector-composer/lib/businessnetworkconnector.js:635:43)\n    at <anonymous>\n    at process._tickCallback (internal/process/next_tick.js:189:7)"
  }
}

но я хочу вывод как: Пожалуйставведите правильный ввод!

...