diff --git a/brownie/exceptions.py b/brownie/exceptions.py index e20fa25ac..56ccf669a 100644 --- a/brownie/exceptions.py +++ b/brownie/exceptions.py @@ -79,6 +79,9 @@ def __init__(self, exc: ValueError) -> None: pass if isinstance(exc, dict) and "message" in exc: + if "data" not in exc: + raise ValueError(exc["message"]) from None + self.message: str = exc["message"] try: txid, data = next((k, v) for k, v in exc["data"].items() if k.startswith("0x")) @@ -95,7 +98,7 @@ def __init__(self, exc: ValueError) -> None: if self.revert_msg is None and self.revert_type in ("revert", "invalid opcode"): self.revert_msg = brownie.project.build._get_dev_revert(self.pc) else: - self.message = str(exc) + raise ValueError(str(exc)) from None def __str__(self) -> str: if not hasattr(self, "revert_type"):