Skip to content

Rework how exceptions work so they carry more information#346

Merged
jadolg merged 6 commits intomasterfrom
rework-exceptions
Jan 19, 2026
Merged

Rework how exceptions work so they carry more information#346
jadolg merged 6 commits intomasterfrom
rework-exceptions

Conversation

@jadolg
Copy link
Owner

@jadolg jadolg commented Jan 17, 2026

Now exceptions will have error data in them. Eg:

try:
    testuser = logged_rocket.users_info(username="testuser1")
except RocketApiException as e:
    if e.error == "User not found":
        testuser = logged_rocket.users_create(
            "testuser1@domain.com", "testuser1", "password", "testuser1"
        )
    else:
        raise e

or

try:
    logged_rocket.channels_leave("GENERAL")
except RocketApiException as e:
    if e.error_type == "error-you-are-last-owner":
        print("Not allowed to leave cause you are the last owner")

@codecov
Copy link

codecov bot commented Jan 17, 2026

Codecov Report

❌ Patch coverage is 94.19355% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.34%. Comparing base (dca3f7b) to head (c7cfe2a).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
tests/test_channels.py 63.63% 2 Missing and 2 partials ⚠️
tests/test_groups.py 63.63% 4 Missing ⚠️
tests/conftest.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #346      +/-   ##
==========================================
+ Coverage   99.25%   99.34%   +0.08%     
==========================================
  Files          43       44       +1     
  Lines        2025     2144     +119     
  Branches      139      143       +4     
==========================================
+ Hits         2010     2130     +120     
- Misses          8       10       +2     
+ Partials        7        4       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud
Copy link

@jadolg jadolg self-assigned this Jan 17, 2026
@jadolg jadolg linked an issue Jan 17, 2026 that may be closed by this pull request
@jadolg jadolg merged commit 4d15570 into master Jan 19, 2026
36 of 37 checks passed
@jadolg jadolg deleted the rework-exceptions branch January 19, 2026 13:08
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.

New status code exceptions make error handling clunky

1 participant