-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handle error thrown by status task (#541)
Use a whitelist to determine whether a code `IgnitionError` should be rethrown as a Hardhat plugin error. This list can be added to as more Ignition errors are identified as being better displayed as HH errors. We intend to extend the HH error code mechanism to give Ignition even more control over the display of errors in HH. This change only adds this rethrow for status and the unrecognised deployment entry currently. Fixes #527.
- Loading branch information
Showing
2 changed files
with
26 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/hardhat-plugin/src/utils/shouldBeHardhatPluginError.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { IgnitionError } from "@nomicfoundation/ignition-core"; | ||
|
||
/* | ||
This is a whitelist of error codes that should be rethrown as NomicLabsHardhatPluginError. | ||
*/ | ||
const whitelist = ["800"]; | ||
|
||
export function shouldBeHardhatPluginError(error: IgnitionError): boolean { | ||
const code = error.message.match(/IGN([0-9]+):/)![1]; | ||
|
||
return whitelist.includes(code); | ||
} |