Skip to content

fix(handler): replace raise e with bare raise and use is None#135

Open
Jah-yee wants to merge 1 commit into
ipinfo:masterfrom
Jah-yee:master
Open

fix(handler): replace raise e with bare raise and use is None#135
Jah-yee wants to merge 1 commit into
ipinfo:masterfrom
Jah-yee:master

Conversation

@Jah-yee

@Jah-yee Jah-yee commented Jul 20, 2026

Copy link
Copy Markdown

Summary

Fixes an exception chaining anti-pattern in Handler.getBatchDetailsIter that was masking original tracebacks, and applies PEP 8 style consistency in getBatchDetails.

Changes

  1. Replace raise e with bare raise (line 395)

    raise e creates a new exception without preserving the original traceback,
    making debugging significantly harder. Bare raise re-raises the active
    exception while keeping the full chain intact.

  2. Use is None instead of == None in getBatchDetails (line 235)

    PEP 8 style consistency — the sibling method getBatchDetailsIter already
    uses is None.

Impact

  • Tracebacks from network and HTTP errors are now fully actionable.
  • No behaviour change for successful requests or existing callers.

Verification

python3 -m py_compile ipinfo/handler.py   # passes

- Replace 'raise e' with bare 'raise' in getBatchDetailsIter to preserve
  the original exception traceback instead of creating a new exception
- Replace 'batch_size == None' with 'batch_size is None' in getBatchDetails
  for PEP 8 style consistency (getBatchDetailsIter already uses 'is None')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant