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
TL;DR parseParameters shouldn't write a error level log for failure to JSON parse an arg. Make it debug level.
parseParameters works fine if you are sending your chaincode arguments as JSON objects or numbers. But litters error logs if you don't... which seems unnecessary.
Example:
['changeOwner', 'asset_1', 'user_2'] would result in 2 error logs
"failed to parse param user_1"
"failed to parse param user_2"
I guess the assumption is that developers will send those arguments as an array:
['changeOwner', ['asset_1', 'user_2']]
However, doing this makes destructing parsedParameters in ChaincodeBase.js:105 less useful let payload = await method.call(this, stub, this.getTransactionHelperFor(stub), ...parsedParameters);
Example ideal use case:
// In chaincode
function changeOwner(asset, new_owner){
// Change the asset owner.
}
The text was updated successfully, but these errors were encountered:
@janb87@kueckermann i agree it's a bit weird that we are throwing an error there, while we are actually resolving the issue. It's ok for me to replace this with just a debug log.
@kueckermann do you want to provide a PR for this?
TL;DR parseParameters shouldn't write a error level log for failure to JSON parse an arg. Make it debug level.
parseParameters works fine if you are sending your chaincode arguments as JSON objects or numbers. But litters error logs if you don't... which seems unnecessary.
Example:
['changeOwner', 'asset_1', 'user_2'] would result in 2 error logs
I guess the assumption is that developers will send those arguments as an array:
['changeOwner', ['asset_1', 'user_2']]
However, doing this makes destructing parsedParameters in ChaincodeBase.js:105 less useful
let payload = await method.call(this, stub, this.getTransactionHelperFor(stub), ...parsedParameters);
Example ideal use case:
The text was updated successfully, but these errors were encountered: