hardhat
Version:
Hardhat is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.
22 lines • 998 B
JavaScript
import { getErrorChain } from "../telemetry/error-classification/helpers.js";
/**
* Detect whether a given error was caused by an invalid HTTP(S) proxy URL in
* the environment.
*
* `getDispatcher` wraps that failure as a `DispatcherError` whose cause is an
* `InvalidProxyUrlError`. Download helpers may wrap it again as a HardhatError.
* Walking the cause chain finds the original configuration error in every case.
*/
export function detectInvalidProxyUrl(error) {
// Compared by name rather than with `hasErrorClassName`, as importing the
// class as a value would load `hardhat-utils/request` at CLI startup.
for (const chainedError of getErrorChain(error)) {
if (chainedError.name === "InvalidProxyUrlError" &&
"envVarName" in chainedError &&
typeof chainedError.envVarName === "string") {
return { envVarName: chainedError.envVarName };
}
}
return undefined;
}
//# sourceMappingURL=invalid-proxy-url-error.js.map