You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 30, 2018. It is now read-only.
Using node I make a typical API POST request for which I have a .catch block with response variable say err. On error, the response body is returned as such (as seen from the Hyperledger Composer REST app)
{
"error": {
"statusCode": 500,
"name": "Error",
"message": "error trying invoke chaincode. Error: chaincode error (status: 500, message: Error: Payment needs to be of positive value)",
"stack": "Error: error trying invoke chaincode. Error: chaincode error (status: 500, message: Error: Payment needs to be of positive value)\n at _initializeChannel.then.then.then.then.catch (/home/ubuntu/.nvm/versions/node/v6.11.1/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:839:34)"
}
}
My Issue
I am simply trying to fetch the message property from the above response and send it to the UI. But weirdly err.messagedoes not give me the value I see inside message but returns the entire response body(same with err.stack).
So basically -- err, err.message and err.stack returns the same output
How do I end up fetching only the value inside a property say message ?
PS: err.statusCode does return the correct value ie. "500". err.name returns "StatusCodeError"(not "Error" that I see in the response)
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Description
Using node I make a typical API POST request for which I have a
.catch
block with response variable sayerr
. On error, the response body is returned as such (as seen from the Hyperledger Composer REST app)My Issue
I am simply trying to fetch the
message
property from the above response and send it to the UI. But weirdlyerr.message
does not give me the value I see insidemessage
but returns the entire response body(same witherr.stack
).So basically --
err
,err.message
anderr.stack
returns the same outputHow do I end up fetching only the value inside a property say
message
?PS:
err.statusCode
does return the correct value ie. "500".err.name
returns "StatusCodeError"(not "Error" that I see in the response)The text was updated successfully, but these errors were encountered: