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

Refactor error handling to use exceptions #1719

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Commits on Dec 30, 2023

  1. Refactor error handling to use exceptions

    cibuildwheel has up until now handled most errors by printing an error message to sys.stderr and calling sys.exit. Others were handled using Logger.error, depending on the context. We also had return codes, but these weren't explicitly defined anywhere.
    
    This makes that convention more explicit and codified. Now to halt the program, the correct thing to do is to throw a cibuildwheel.errors.FatalError exception - that is caught in main() and printed before exiting. The existing behaviour was kept - if an error occurs within a build step (probably something to do with the build itself), the Logger.error() method is used. Outside of a build step (e.g. a misconfiguration), the behaviour is still to print 'cibuildwheel: <message>'
    
    I also took the opportunity to add a debugging option `--debug-traceback` (and `CIBW_DEBUG_TRACEBACK`), which you can enable to see a full traceback on errors.
    
    (I've deactivated the flake8-errmsg lint rule, as it was throwing loads of errors and these error messages aren't generally seen in a traceback context)
    joerick committed Dec 30, 2023
    Configuration menu
    Copy the full SHA
    736931a View commit details
    Browse the repository at this point in the history

Commits on Jan 6, 2024

  1. add noqa rule

    joerick committed Jan 6, 2024
    Configuration menu
    Copy the full SHA
    8f0f4ba View commit details
    Browse the repository at this point in the history

Commits on Jan 19, 2024

  1. Apply suggestions from code review

    Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
    joerick and henryiii committed Jan 19, 2024
    Configuration menu
    Copy the full SHA
    403a132 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2631626 View commit details
    Browse the repository at this point in the history

Commits on Jan 26, 2024

  1. Code review suggestions

    joerick committed Jan 26, 2024
    Configuration menu
    Copy the full SHA
    46e437d View commit details
    Browse the repository at this point in the history

Commits on Mar 2, 2024

  1. Configuration menu
    Copy the full SHA
    dc60bf8 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    aab0195 View commit details
    Browse the repository at this point in the history