Skip to content

Commit 59265eb

Browse files
authored
feat: set up custom exceptions (#108)
Fixes #71
1 parent 1a32a9a commit 59265eb

File tree

5 files changed

+26
-1
lines changed

5 files changed

+26
-1
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ repos:
6060
hooks:
6161
- id: mdformat
6262
args: [--number, --wrap=120, --ignore-missing-references]
63-
exclude: CHANGELOG.md|.changelog.md|docs/src/cli.md
63+
exclude: CHANGELOG.md|.changelog.md|docs/src/cli.md|docs/src/exceptions.md
6464
additional_dependencies:
6565
- mdformat-mkdocs[recommended]>=v2.0.7
6666

docs/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ nav:
1717
- Home: index.md
1818
- Reference:
1919
- API Reference: api.md
20+
- Exceptions: exceptions.md
2021
- Command Line Interface: cli.md
2122
- Meta:
2223
- Contributor Guide: contributing.md

docs/src/exceptions.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Exceptions
2+
3+
::: re3data._exceptions

src/re3data/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@
66

77
from re3data.__about__ import __version__
88
from re3data._client import Client
9+
from re3data._exceptions import Re3dataError, RepositoryNotFoundError
910

1011
__all__ = [
1112
"__version__",
1213
"Client",
14+
"Re3dataError",
15+
"RepositoryNotFoundError",
1316
]
1417

1518
_client = Client()

src/re3data/_exceptions.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# SPDX-FileCopyrightText: 2024 Heinz-Alexander Fütterer
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
"""The _exceptions module defines exception classes for handling error scenarios encountered when using the re3data API.
6+
7+
Classes:
8+
Re3dataError: Base exception class for errors related to the re3data API.
9+
RepositoryNotFoundError: Exception raised when a repository is not found.
10+
"""
11+
12+
13+
class Re3dataError(Exception):
14+
"""Base exception class for errors related to the re3data API."""
15+
16+
17+
class RepositoryNotFoundError(Re3dataError):
18+
"""Exception raised when a repository is not found."""

0 commit comments

Comments
 (0)