Skip to content

Commit

Permalink
Add base status exception class and subclass from it
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjacob committed Aug 19, 2024
1 parent a6df162 commit f5aa140
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.3.4] - 2024-08-19

### Added
- Base status error class that all other inherit from

## [0.3.3] - 2024-08-19

### Changed
Expand Down
15 changes: 9 additions & 6 deletions blackboard/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Blackboard REST API exceptions."""

# Copyright (C) 2023, Jacob Sánchez Pérez
# Copyright (C) 2024, Jacob Sánchez Pérez

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand All @@ -18,18 +18,21 @@
# MA 02110-1301, USA.

from typing import Any, NoReturn
from tiny_api_client import APIStatusError


class BBBadRequestError(Exception):
class BBStatusError(Exception):
pass


class BBUnauthorizedError(Exception):
class BBBadRequestError(BBStatusError):
pass


class BBForbiddenError(Exception):
class BBUnauthorizedError(BBStatusError):
pass


class BBForbiddenError(BBStatusError):
pass


Expand All @@ -42,4 +45,4 @@ def status_handler(client: Any, status_code: Any, response: Any) -> NoReturn:
case 403:
raise BBForbiddenError(response)
case _:
raise APIStatusError(status_code)
raise BBStatusError(response)

0 comments on commit f5aa140

Please sign in to comment.