From anonymous, 1 Month ago, written in Python.
Embed
  1. class DeserializationError:
  2.     pass
  3.  
  4.  
  5. @contextlib.contextmanager
  6. def _map_exceptions():
  7.     """Handle exception API differences in adblock 0.5.0."""
  8.     adblock_deserialization_error = getattr(
  9.         adblock, "DeserializationError", ValueError)
  10.  
  11.     try:
  12.         yield
  13.     except adblock_deserialization_error as e:
  14.         if isinstance(e, ValueError) and str(e) != "DeserializationError":
  15.             # All Rust exceptions get turned into a ValueError by
  16.             # python-adblock
  17.             raise
  18.         raise DeserializationError(str(e))

Replies to Untitled rss

Title Name Language When
Re: Untitled anonymous python 1 Month ago.