Skip to content

Commit

Permalink
Rename base exception to MijnbibError
Browse files Browse the repository at this point in the history
  • Loading branch information
wvanhed committed Dec 26, 2023
1 parent ea8cb6e commit 2216b6f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

new: new feature / impr: improvement / fix: bug fix

## WIP

- new: rename base exception to MijnbibError
- impr: general internal improvements

## v0.2.0 - 2023-12-20

- new: Add extend_by_ids method
Expand Down
2 changes: 1 addition & 1 deletion src/mijnbib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
ExtendLoanError,
IncompatibleSourceError,
ItemAccessError,
PluginError,
MijnbibError,
TemporarySiteError,
)
from .mijnbibliotheek import MijnBibliotheek
Expand Down
16 changes: 8 additions & 8 deletions src/mijnbib/errors.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
class PluginError(Exception):
class MijnbibError(Exception):
"""Base exception."""


# *** client-side errors ***


class AuthenticationError(PluginError):
class AuthenticationError(MijnbibError):
"""Raised when authentication has failed."""


class ItemAccessError(PluginError):
class ItemAccessError(MijnbibError):
"""Raised when an item (loan, reservation) could not be accessed.
This is likely a client-side error, but in rare cases might have a
server-side cause.
"""


class InvalidExtendLoanURL(PluginError):
class InvalidExtendLoanURL(MijnbibError):
"""Raised when the extending loan(s) url is not considered valid."""


# *** server-side errors ***


class CanNotConnectError(PluginError):
class CanNotConnectError(MijnbibError):
"""Raised when a url can not be reached.
Args:
Expand All @@ -37,7 +37,7 @@ def __init__(self, msg: str, url: str):
self.url = url


class IncompatibleSourceError(PluginError):
class IncompatibleSourceError(MijnbibError):
"""Raised for any general errors in parsing the source.
Args:
Expand All @@ -50,9 +50,9 @@ def __init__(self, msg, html_body: str):
self.html_body = html_body


class ExtendLoanError(PluginError):
class ExtendLoanError(MijnbibError):
"""Raised when extending loan(s) failed for unclear reasons."""


class TemporarySiteError(PluginError):
class TemporarySiteError(MijnbibError):
"""Raised when the site reports a temporary error."""
2 changes: 1 addition & 1 deletion tests/test_mijnbib.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_mijnbib_available_imports():
"CanNotConnectError",
"ExtendLoanError",
"IncompatibleSourceError",
"PluginError",
"MijnbibError",
"TemporarySiteError",
"errors",
"mijnbibliotheek",
Expand Down

0 comments on commit 2216b6f

Please sign in to comment.