Skip to content

Centralize error handling in _mk_auth_req#76

Merged
ncoop57 merged 2 commits intomainfrom
plash-err
Mar 25, 2026
Merged

Centralize error handling in _mk_auth_req#76
ncoop57 merged 2 commits intomainfrom
plash-err

Conversation

@ncoop57
Copy link
Copy Markdown
Contributor

@ncoop57 ncoop57 commented Mar 25, 2026

Summary

Refactors error handling to raise PlashError with meaningful messages directly in _mk_auth_req, eliminating redundant error checks throughout the codebase.

Changes

  • _mk_auth_req now raises PlashError on non-200 responses with a descriptive message (from X-Plash-Error header, response body, or HTTP status)
  • Removes duplicate if not r: raise PlashError(...) checks from all API functions
  • Adds tests for the new error handling behavior

Benefits

  • Consistent error messages surfaced to users
  • Cleaner code with single point of error handling
  • Properly handles cases where X-Plash-Error header is missing

@ncoop57 ncoop57 added the enhancement New feature or request label Mar 25, 2026
@github-actions
Copy link
Copy Markdown

📖 Documentation Preview: https://plash-docs-pr-76.pla.sh

@ncoop57 ncoop57 merged commit 1a98914 into main Mar 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant