File tree Expand file tree Collapse file tree 4 files changed +34
-0
lines changed
v-next/hardhat/src/internal/builtin-plugins Expand file tree Collapse file tree 4 files changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " hardhat " : patch
3
+ ---
4
+
5
+ Report stack trace generation errors to Sentry ([ #7010 ] ( https://github.com/NomicFoundation/hardhat/issues/7010 ) )
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ import debug from "debug";
44
44
import { hexToBytes } from "ethereum-cryptography/utils" ;
45
45
import { addr } from "micro-eth-signer" ;
46
46
47
+ import { sendErrorTelemetry } from "../../../cli/telemetry/sentry/reporter.js" ;
47
48
import {
48
49
EDR_NETWORK_REVERT_SNAPSHOT_EVENT ,
49
50
OPTIMISM_CHAIN_TYPE ,
@@ -59,6 +60,7 @@ import {
59
60
UnknownError ,
60
61
} from "../provider-errors.js" ;
61
62
63
+ import { EdrProviderStackTraceGenerationError } from "./stack-traces/stack-trace-generation-errors.js" ;
62
64
import { createSolidityErrorWithStackTrace } from "./stack-traces/stack-trace-solidity-errors.js" ;
63
65
import {
64
66
isDebugTraceResult ,
@@ -319,6 +321,10 @@ export class EdrProvider extends BaseProvider {
319
321
try {
320
322
stackTrace = edrResponse . stackTrace ( ) ;
321
323
} catch ( e ) {
324
+ if ( e instanceof Error ) {
325
+ await sendErrorTelemetry ( new EdrProviderStackTraceGenerationError ( e ) ) ;
326
+ }
327
+
322
328
log ( "Failed to get stack trace: %O" , e ) ;
323
329
}
324
330
Original file line number Diff line number Diff line change
1
+ import { CustomError } from "@nomicfoundation/hardhat-utils/error" ;
2
+
3
+ abstract class StackTraceGenerationError extends CustomError { }
4
+
5
+ export class EdrProviderStackTraceGenerationError extends StackTraceGenerationError {
6
+ constructor ( error : Error ) {
7
+ super ( "Failed to generate stack trace for the EDR provider" , error ) ;
8
+ }
9
+ }
10
+
11
+ export class SolidityTestStackTraceGenerationError extends StackTraceGenerationError {
12
+ constructor ( message : string ) {
13
+ super (
14
+ "Failed to generate stack trace for the Solidity test" ,
15
+ new Error ( message ) ,
16
+ ) ;
17
+ }
18
+ }
Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ import type { TestResult } from "@ignored/edr-optimism";
8
8
import { bytesToHexString } from "@nomicfoundation/hardhat-utils/hex" ;
9
9
import chalk from "chalk" ;
10
10
11
+ import { sendErrorTelemetry } from "../../cli/telemetry/sentry/reporter.js" ;
12
+ import { SolidityTestStackTraceGenerationError } from "../network-manager/edr/stack-traces/stack-trace-generation-errors.js" ;
11
13
import { encodeStackTraceEntry } from "../network-manager/edr/stack-traces/stack-trace-solidity-errors.js" ;
12
14
13
15
import { formatArtifactId , formatLogs , formatTraces } from "./formatters.js" ;
@@ -210,6 +212,9 @@ export async function* testReporter(
210
212
}
211
213
break ;
212
214
case "UnexpectedError" :
215
+ await sendErrorTelemetry (
216
+ new SolidityTestStackTraceGenerationError ( stackTrace . errorMessage ) ,
217
+ ) ;
213
218
yield `Stack Trace Warning: ${ chalk . grey ( stackTrace . errorMessage ) } \n` ;
214
219
break ;
215
220
case "UnsafeToReplay" :
You can’t perform that action at this time.
0 commit comments