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 • 966 B
JavaScript
import { HardhatError } from "@nomicfoundation/hardhat-errors";
import { FileBuildResultType } from "../../../types/solidity.js";
/**
* This function asserts that the given Solidity build results are successful.
* It throws a HardhatError if the build results indicate that the compilation
* job failed.
*/
export function throwIfSolidityBuildFailed(results) {
if ("reason" in results) {
throw new HardhatError(HardhatError.ERRORS.CORE.SOLIDITY.COMPILATION_JOB_CREATION_ERROR, {
reason: results.formattedReason,
rootFilePath: results.rootFilePath,
buildProfile: results.buildProfile,
});
}
const successful = [...results.values()].every(({ type }) => type === FileBuildResultType.CACHE_HIT ||
type === FileBuildResultType.BUILD_SUCCESS);
if (!successful) {
throw new HardhatError(HardhatError.ERRORS.CORE.SOLIDITY.BUILD_FAILED);
}
}
//# sourceMappingURL=build-results.js.map