Skip to content

Commit 93b8b25

Browse files
committed
Print error cause when showing stack traces
1 parent 5f926b6 commit 93b8b25

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

v-next/hardhat/src/internal/cli/error-handler.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import util from "node:util";
2-
31
import {
42
HardhatError,
53
HardhatPluginError,
@@ -69,7 +67,7 @@ interface ErrorMessages {
6967
export function printErrorMessages(
7068
error: unknown,
7169
shouldShowStackTraces: boolean = false,
72-
print: (message: string) => void = console.error,
70+
print: (message: any) => void = console.error,
7371
): void {
7472
const showStackTraces =
7573
shouldShowStackTraces ||
@@ -85,7 +83,7 @@ export function printErrorMessages(
8583
print("");
8684

8785
if (showStackTraces) {
88-
print(error instanceof Error ? `${error.stack}` : `${util.inspect(error)}`);
86+
print(error);
8987
if (postErrorStackTraceMessage !== undefined) {
9088
print("");
9189
print(postErrorStackTraceMessage);

0 commit comments

Comments
 (0)