Skip to content

Conversation

@Omswastik-11
Copy link

@Omswastik-11 Omswastik-11 commented Dec 29, 2025

Overview

This PR introduces a new OpenMLAuthenticationError exception to clearly distinguish authentication errors (invalid or missing API key) from authorization errors (valid API key without sufficient permissions).


Changes

New Exception

  • Added OpenMLAuthenticationError in exceptions.py

  • Inherits from OpenMLServerError for consistency

  • Automatically appends helpful guidance with links to:

  • Includes a clear docstring explaining the difference between authentication and authorization errors


Updated Error Handling

  • Updated _api_calls.py to:

    • Import and raise OpenMLAuthenticationError for authentication failures

Tests Updated

  • Updated test_authentication_endpoints_requiring_api_key_show_relevant_help_link

    • Now expects OpenMLAuthenticationError instead of OpenMLNotAuthorizedError
    • Continues to assert that helpful guidance is included in the error message

Fixes #1562

@Omswastik-11 Omswastik-11 changed the title [ENH] add openmlauthentication Error exception [ENH] Add OpenMLAuthenticationError for clearer API key error handling Dec 29, 2025
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.67%. Comparing base (3454bbb) to head (8b7d70e).

Files with missing lines Patch % Lines
openml/exceptions.py 0.00% 4 Missing ⚠️
openml/_api_calls.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1570      +/-   ##
==========================================
- Coverage   52.72%   43.67%   -9.06%     
==========================================
  Files          36       36              
  Lines        4326     4330       +4     
==========================================
- Hits         2281     1891     -390     
- Misses       2045     2439     +394     

☔ 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.

Copy link

@jgyasu jgyasu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

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.

[ENH] Add OpenMLAuthenticationError and improve Error Message When API Key is Invalid

4 participants