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
When importing a smart contract throws an error, the CLI assumes that it "failed to find the smart contract in your build directory". It logs that error message to the user and exits.
` Failed to find the "${contractName}" smart contract in your build directory.\n Please confirm that your config.json contains the name of the smart contract that you desire to deploy to this deploy alias.`
)
);
However, there are many errors that can happen when importing a contract. Thererfore, it's a bad idea to swallow the error like that - it makes it extremely hard for users to find the real error. See #328 for example
Proposed solution is to specifically test whether we can find the contract file in the build directory, and log the existing error if we don't. After that, we just try to import the smart contract. If that fails, node will throw the proper error, which enables the user to identify the problem. If we want to print something pretty, or change the error color, we can achieve that with a try .. catch, but not at the cost of removing the stack trace / full error message.
The text was updated successfully, but these errors were encountered:
jasongitmail
changed the title
Don't hide errors when importing smart contract
Improve error handling when imported smart contract is not found
Jan 5, 2023
When importing a smart contract throws an error, the CLI assumes that it "failed to find the smart contract in your build directory". It logs that error message to the user and exits.
zkapp-cli/src/lib/deploy.js
Lines 222 to 228 in 35f48b1
However, there are many errors that can happen when importing a contract. Thererfore, it's a bad idea to swallow the error like that - it makes it extremely hard for users to find the real error. See #328 for example
Proposed solution is to specifically test whether we can find the contract file in the build directory, and log the existing error if we don't. After that, we just try to import the smart contract. If that fails, node will throw the proper error, which enables the user to identify the problem. If we want to print something pretty, or change the error color, we can achieve that with a
try .. catch
, but not at the cost of removing the stack trace / full error message.The text was updated successfully, but these errors were encountered: