-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Improve error messages for viem assertions #7384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: viem-assertions-revert-does-not-handle-panic-errors
Are you sure you want to change the base?
Improve error messages for viem assertions #7384
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves error messages for viem assertions to make them more user-friendly and consistent. The changes focus on clarifying what was expected versus what actually happened during contract execution.
Key changes include:
- Standardized error message format with clearer language
- Added support for handling reverts without reasons
- Improved messaging for custom error vs non-custom error scenarios
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
revert.ts | Updated test expectations for improved error messages |
revert-with.ts | Added test for revert without reason scenario and updated error message expectations |
revert-with-custom-error.ts | Updated error message expectations and removed unused imports |
revert-with-custom-error-with-args.ts | Updated error message expectation for consistency |
Revert.sol | Added new test function for revert without reason scenario |
revert-with.ts (src) | Added handling for reverts without reasons and improved panic error messaging |
handle-revert.ts | Enhanced return type to handle reverts without reasons and improved error messages |
handle-revert-with-custom-error.ts | Restructured error handling logic and improved error messages |
error-string.ts | Refactored exports and added new utility function for panic error detection |
Comments suppressed due to low confidence (1)
v-next/hardhat-viem-assertions/test/fixture-projects/hardhat-project/contracts/Revert.sol:1
- There's a grammatical error in the test description. It should be 'reverts' instead of 'revert'.
// SPDX-License-Identifier: MIT
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
… github.com:NomicFoundation/hardhat into align-msgs-with-chai-matchers
PR on top of this one: #7354