Skip to content

chore: add isDeprecated flag to ErrorDescriptor interface#7954

Closed
jose-blockchain wants to merge 2 commits intoNomicFoundation:mainfrom
jose-blockchain:chore/add-deprecated-flag-to-error-descriptors
Closed

chore: add isDeprecated flag to ErrorDescriptor interface#7954
jose-blockchain wants to merge 2 commits intoNomicFoundation:mainfrom
jose-blockchain:chore/add-deprecated-flag-to-error-descriptors

Conversation

@jose-blockchain
Copy link

Add optional isDeprecated field to ErrorDescriptor so unused error descriptors can be marked as deprecated instead of deleted. The CLI error handler now shows a deprecation notice for deprecated errors.

Closes #7732

  • Because this PR includes a bug fix, relevant tests have been included.
  • Because this PR includes a new feature, the change was previously discussed on an Issue or with someone from the team.
  • I didn't do anything of this.

Changes

  • Added optional isDeprecated?: true field to the ErrorDescriptor interface in hardhat-errors
  • Updated the CLI error handler to append a yellow deprecation notice when a deprecated error is thrown (both core and plugin errors)
  • Added tests for the new field in hardhat-errors/test/errors.ts (4 tests)
  • Added tests for the deprecation notice in hardhat/test/internal/cli/error-handler.ts (2 tests)

How it works

When an error descriptor has isDeprecated: true, the CLI output includes:

Note: This error is deprecated and will be removed in a future version of Hardhat. Please consider upgrading Hardhat.

This allows the website to clearly mark deprecated errors and avoids deleting descriptors that older Hardhat versions may still throw.

Add optional `isDeprecated` field to ErrorDescriptor so unused error
descriptors can be marked as deprecated instead of deleted. The CLI
error handler now shows a deprecation notice for deprecated errors.

Closes NomicFoundation#7732

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot
Copy link

changeset-bot bot commented Feb 15, 2026

🦋 Changeset detected

Latest commit: 0102d65

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@nomicfoundation/hardhat-errors Patch
hardhat Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Add isDeprecated flag to ErrorDescriptor interface in Hardhat.
@alcuadrado
Copy link
Member

Thanks for this PR, @jose-blockchain. Unfortunately, it's not really helpful. The reason is that we don't delete error descriptors, as we use them to generate the error documentation in the website. And we want older versions of Hardhat to still be able to print valid links to deprecated errors

@alcuadrado alcuadrado closed this Feb 15, 2026
@jose-blockchain
Copy link
Author

Ok, got it @alcuadrado , thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for deprecating error descriptors

3 participants