Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove useless frames from exc tracebacks #215

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dank_mids/_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,13 +773,13 @@ async def post(self) -> Tuple[List[RawResponse], List[Union[Multicall, RPCReques
logger.debug("caught %s for %s, reraising", e, self)
if ENVS.DEBUG: # type: ignore [attr-defined]
_debugging.failures.record(self.controller.chain_id, e, type(self).__name__, self.uid, len(self), self.data)
raise e
raise
except Exception as e:
if 'broken pipe' in str(e).lower():
logger.warning("This is what broke the pipe: %s", self.method_counts)
if ENVS.DEBUG: # type: ignore [attr-defined]
_debugging.failures.record(self.controller.chain_id, e, type(self).__name__, self.uid, len(self), self.data)
raise e
raise
# NOTE: A successful response will be a list of `RawResponse` objects.
# A single `PartialResponse` implies an error.
if isinstance(response, list):
Expand Down
6 changes: 3 additions & 3 deletions dank_mids/brownie_patch/call.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ async def decode_output(call: ContractCall, data: bytes) -> Any:
except AttributeError as e:
# NOTE: Not sure why this happens as we set the attr while patching the call but w/e, this works for now
if not str(e).endswith(" object has no attribute '_skip_decoder_proc_pool'"):
raise e
raise
logger.debug("DEBUG ME BRO: %s", e)
call._skip_decoder_proc_pool = call._address in _skip_proc_pool
return await decode_output(call, data)
Expand Down Expand Up @@ -144,7 +144,7 @@ def __encode_input(abi: Dict[str, Any], signature: str, *args: Tuple[Any,...]) -
break
except Exception as e:
if "429" not in str(e):
raise e
raise
if multicall2 := MULTICALL2_ADDRESSES.get(chainid, None):
_skip_proc_pool.add(to_checksum_address(multicall2))

Expand Down Expand Up @@ -180,5 +180,5 @@ def __validate_output(abi: Dict[str, Any], hexstr: BytesLike):
try:
raise VirtualMachineError(e) from None
except:
raise e
raise e from e.__cause__

2 changes: 1 addition & 1 deletion dank_mids/brownie_patch/overloaded.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async def coroutine(
exc_str = str(e)
breakpoint = exc_str.find("(*args)")
raise ValueError(f"{exc_str[:breakpoint]}.coroutine{exc_str[breakpoint:]}")
raise e
raise

kwargs = {"block_identifier": block_identifier, "decimals": decimals, "override": override}
kwargs = {k: v for k, v in kwargs.items() if v is not None}
Expand Down
2 changes: 1 addition & 1 deletion dank_mids/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ async def __call__(self, method: RPCEndpoint, params: Any) -> RPCResponse:
return await queue(self, method, params)
except TypeError as e:
if "unhashable type" not in str(e):
raise e
raise
return await queue(self, method, _helpers._make_hashable(params))

@eth_retry.auto_retry
Expand Down
Loading