{"id":28387,"library":"tidyexc","title":"tidyexc","description":"tidyexc provides an exception class inspired by the tidyverse style guide for Python. It supports adding structured information to exceptions and formatting tracebacks in a clean, readable way. Current version is 0.10.0, released periodically.","status":"active","version":"0.10.0","language":"python","source_language":"en","source_url":"https://github.com/kalekundert/tidyexc","tags":["exception","error-handling","tidyverse","formatting"],"install":[{"cmd":"pip install tidyexc","lang":"bash","label":"Install via pip"}],"dependencies":[],"imports":[{"note":"The main exception class is named Error, not TidyError.","wrong":"from tidyexc import TidyError","symbol":"Error","correct":"from tidyexc import Error"},{"note":"format_exception_chain is the correct public function; format_exc is internal.","wrong":"from tidyexc import format_exc","symbol":"format_exception_chain","correct":"from tidyexc import format_exception_chain"},{"note":"The function is add_info, not add_info_to_exception.","wrong":"from tidyexc import add_info_to_exception","symbol":"add_info","correct":"from tidyexc import add_info"},{"note":"The context manager is only_raise, not raise_only.","wrong":"from tidyexc import raise_only","symbol":"only_raise","correct":"from tidyexc import only_raise"}],"quickstart":{"code":"from tidyexc import Error, add_info\n\ntry:\n    raise Error('Something went wrong')\nexcept Error as e:\n    add_info(e, user_id=42)\n    raise","lang":"python","description":"Create a custom exception with tidyexc and attach additional context."},"warnings":[{"fix":"Use formatexceptionchain from tidyexc instead of any internal format_exc.","message":"In version 0.8.0, the internal use of format_exc() was removed. Code relying on that internal function must switch to format_exception_chain.","severity":"breaking","affected_versions":">=0.8.0"},{"fix":"Catch tidyexc.Error specifically, or use except Exception as e: only if the error is raised via raise Error('msg').","message":"The Error class is not a subclass of BaseException, but a plain object that wraps exceptions. Catching Exception does not catch tidyexc errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to >=0.7.0 and use add_info recursively.","message":"In version 0.7.0, add_info started supporting recursive calls. Older patterns that manually handle nested exceptions may break.","severity":"deprecated","affected_versions":"<0.7.0"},{"fix":"Use put_info to attach information without modifying the exception chain.","message":"The put_info() function was added in version 0.8.0. It may conflict with add_info if used incorrectly.","severity":"gotcha","affected_versions":">=0.8.0"},{"fix":"Refactor code to not depend on recursive attribute access on info dicts.","message":"In version 0.5.1, the dotmap dependency was replaced with a non-recursive alternative. Code relying on dotmap's recursive behavior for nested attribute access may break.","severity":"breaking","affected_versions":">=0.5.1"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Replace 'from tidyexc import TidyError' with 'from tidyexc import Error'.","cause":"Mis-import: tidyexc exports Error, not TidyError.","error":"NameError: name 'TidyError' is not defined"},{"fix":"Raise an instance of a builtin exception (e.g., RuntimeError) and attach tidyexc.Error via add_info, or use only_raise context manager.","cause":"Raising a tidyexc Error directly without wrapping it in a regular exception.","error":"TypeError: exceptions must derive from BaseException"},{"fix":"Replace tidyexc.format_exc with tidyexc.format_exception_chain.","cause":"Using internal name; public function is format_exception_chain.","error":"AttributeError: module 'tidyexc' has no attribute 'format_exc'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}