Skip to content
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

Error printing for Hardhat v3 #5455

Merged
merged 18 commits into from
Jul 1, 2024
Prev Previous commit
Next Next commit
Add missing types
schaable committed Jun 28, 2024
commit f77d8c0fdd9147db41dd59573a038380c93455c1
4 changes: 2 additions & 2 deletions v-next/hardhat/src/internal/cli/error-handler.ts
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ interface ErrorMessages {
*/
export function printErrorMessages(
error: unknown,
print = console.error,
print: (message: string) => void = console.error,
): void {
const showStackTraces =
process.argv.includes("--show-stack-traces") ||
Copy link
Member

Choose a reason for hiding this comment

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

I'd pass this from main, so that we keep everything argv parsing there. It's a bit unexpected here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done in 8111de5

@@ -81,7 +81,7 @@ export function printErrorMessages(
print("");

if (showStackTraces) {
print(error instanceof Error ? error.stack : error);
print(error instanceof Error ? `${error.stack}` : `${error}`);
if (postErrorStackTraceMessage !== undefined) {
print("");
print(postErrorStackTraceMessage);
2 changes: 1 addition & 1 deletion v-next/hardhat/test/helpers/env-vars.ts
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ export function createTestEnvManager() {
});

return {
setEnvVar(name: string, value: string | undefined) {
setEnvVar(name: string, value: string | undefined): void {
// Before setting a new value, save the original value if it hasn't been saved yet
if (!changes.has(name)) {
originalValues.set(name, process.env[name]);