Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.

Ignored Errors from chaincode #54

Open
walmon opened this issue Feb 28, 2019 · 0 comments
Open

Ignored Errors from chaincode #54

walmon opened this issue Feb 28, 2019 · 0 comments

Comments

@walmon
Copy link
Contributor

walmon commented Feb 28, 2019

The problem

When an Error occurs inside of the chaincode (i.e.: making a throw new Error(...)) the returning message is not parsed as an Error object, therefore errors are going missing. It's returning null right now.

Environment

  • Convector version (or git revision) that exhibits the issue: 1.2.0
  • Last Convector version that did not exhibit the issue (if applicable):
  • OS/version: MAC Mojave 10.14
  • Node.js version: v8.12.0
  • Npm or Yarn package manager: 6.4.1
  • Convector CLI version (if applicable): 1.0.6
  • Hurley CLI version (if applicable):

Details

Unexpected way of handling errors, looks like Fabric changed something from 1.1 to 1.3-1.4.

Current Behavior

It returns null instead of an Error object.

Expected Behavior

Throw the original Error.

Code To Reproduce Issue [ Good To Have ]

Inside a controller

throw new Error(`Ups, the requesting identity is not authorized to update the model`);

In a unit test just call it with a try catch and the error won't be found, but the response will be null.

 try {
            let rs = await mybuggychaincodeCtrl.update(modelSample);
            // returns null
            console.log(rs);
            await expect.fail('Should have failed');
        } catch (ex) {
            // should fall in here
            console.log(ex);
        }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant