Skip to content

fix: replace bare except with except BaseException in token_create#905

Open
harshadkhetpal wants to merge 1 commit intoCheckmk:masterfrom
harshadkhetpal:fix/bare-except-token-create
Open

fix: replace bare except with except BaseException in token_create#905
harshadkhetpal wants to merge 1 commit intoCheckmk:masterfrom
harshadkhetpal:fix/bare-except-token-create

Conversation

@harshadkhetpal
Copy link
Copy Markdown

Summary

Replace bare except: clause with except BaseException: in cmk/gui/dashboard/api/token_create.py (PEP 8 E722).

Why: Bare except: is equivalent to except BaseException: but is less explicit. Since this block performs a rollback and re-raises, except BaseException: is the correct explicit form — it documents the intent to catch everything during the rollback.

Change:

# Before
except:
    # rollback token creation
    token_store.delete(token.token_id)
    raise

# After
except BaseException:
    # rollback token creation
    token_store.delete(token.token_id)
    raise

Testing

No behavior change — except BaseException: is semantically identical to except: but satisfies PEP 8 E722.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA or my organization already has a signed CLA.


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

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