diff --git a/main.py b/main.py index 0534037..27fa255 100644 --- a/main.py +++ b/main.py @@ -3,7 +3,7 @@ from enum import Enum from pathlib import Path from typing import Annotated -from ape_vyper.exceptions import VyperCompileError +from ape.managers.compiler import CompilerError from ape import Project from ethpm_types import PackageManifest @@ -178,6 +178,7 @@ async def compile_project(project_root: Path, manifest: PackageManifest): # Create a contracts directory contracts_dir = project_root / "contracts" contracts_dir.mkdir() + # add request contracts in temp directory if manifest.sources: for filename, source in manifest.sources.items(): @@ -187,16 +188,14 @@ async def compile_project(project_root: Path, manifest: PackageManifest): path.write_text(source.fetch_content()) try: project = Project(project_root) - project.load_contracts() compiled_manifest = project.extract_manifest() results[project_root.name] = compiled_manifest tasks[project_root.name] = TaskStatus.SUCCESS - except VyperCompileError as e: + except CompilerError as e: results[project_root.name] = [ f"{e['sourceLocation'].get('file', 'Unknown file')}\n{e['type']}: {e.get('formattedMessage', e['message'])}" for e in e.base_err.error_dict ] - tasks[project_root.name] = TaskStatus.FAILED except Exception as e: results[project_root.name] = {e.__class__.__name__:str(e)}