Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Change display name of @truffle/error and remove its stack property #5787

Merged
merged 1 commit into from
Jan 4, 2023

Conversation

cds-amal
Copy link
Member

@cds-amal cds-amal commented Dec 15, 2022

When using the bundle, I noticed @truffle/error includes a stack trace, unlike the unbundled behavior. @truffle/error's intent is to give the user an action and does not need a stack trace.

Error with stack trace

Solidity console.log detected in the following assets:
Telephone.json

ExtendableError: You are trying to deploy contracts that use console.log.
Please fix, or disable this check by setting solidityLog.preventConsoleLogMigration to false

    at module.exports (/home/amal/work/trees/truffle/console.log/packages/truffle/build/webpack:/packages/core/lib/commands/migrate/runMigrations.js:87:1)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at module.exports (/home/amal/work/trees/truffle/console.log/packages/truffle/build/webpack:/packages/core/lib/commands/migrate/setUpDryRunEnvironmentThenRunMigrations.js:37:1)
    at Object.module.exports [as run] (/home/amal/work/trees/truffle/console.log/packages/truffle/build/webpack:/packages/core/lib/commands/migrate/run.js:33:1)
    at runCommand (/home/amal/work/trees/truffle/console.log/packages/truffle/build/webpack:/packages/core/lib/command-utils.js:201:1)
Truffle v5.6.9 (core: 5.6.9)
Node v18.12.1

How to test

  1. bootstrap the repo
  2. unbox metacoin, config and run migrate with mutually exclusive --url and --network options with truffle bundle.
    reprod
    use-truffle-bundle # if you have the truffle dotfiles setup!
    truffle unbox metacoin
    truffle console --url http://127.0.0.1 --network development
  3. There should be no stack trace! (Make sure you use the bundle)

@truffle/error's intent is to give the user an action to perform and
does not need a stack trace.

- rename @truffle/error to be TruffleError
- set the stack to  so there is not stacktrace when using bundle
Copy link
Contributor

@sukanyaparashar sukanyaparashar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, @cds-amal . Tested it locally. While checking out to your branch, I needed to do yarn bootstrap first for changes to reflect in the error/dist/src folder. May be you want to mention it in the test instructions too.

Copy link
Contributor

@dongmingh dongmingh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test result displays a helpful message and no more stack trace:

$ truffle console --url http://127.0.0.1 --network development
Mutually exclusive options, --url and --network detected!
Please use either --url or --network and try again.
See: https://trufflesuite.com/docs/truffle/reference/truffle-commands/#console

@cds-amal cds-amal merged commit 88a9b5f into develop Jan 4, 2023
@cds-amal cds-amal deleted the err-unstack branch January 4, 2023 16:58
@cds-amal cds-amal added error better issue indicates improvement to error messaging internal improvement labels Jan 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
error better issue indicates improvement to error messaging internal improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants