Skip to content

Commit 3c0ac20

Browse files
refactor: prefix helper functions with an underscore
1 parent fab90a6 commit 3c0ac20

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

src/gitingest/exceptions.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
""" Custom exceptions for the GitIngest package. """
2+
3+
14
class InvalidPatternError(ValueError):
25
"""
36
Exception raised when a pattern contains invalid characters.
4-
57
This exception is used to signal that a pattern provided for some operation
68
contains characters that are not allowed. The valid characters for the pattern
79
include alphanumeric characters, dash (-), underscore (_), dot (.), forward slash (/),
810
plus (+), and asterisk (*).
9-
1011
Parameters
1112
----------
1213
pattern : str
@@ -27,3 +28,24 @@ class AsyncTimeoutError(Exception):
2728
This exception is used by the `async_timeout` decorator to signal that the wrapped
2829
asynchronous function has exceeded the specified time limit for execution.
2930
"""
31+
32+
33+
class MaxFilesReachedError(Exception):
34+
"""Exception raised when the maximum number of files is reached."""
35+
36+
def __init__(self, max_files: int) -> None:
37+
super().__init__(f"Maximum number of files ({max_files}) reached.")
38+
39+
40+
class MaxFileSizeReachedError(Exception):
41+
"""Raised when the maximum file size is reached."""
42+
43+
def __init__(self, max_size: int):
44+
super().__init__(f"Maximum file size limit ({max_size/1024/1024:.1f}MB) reached.")
45+
46+
47+
class AlreadyVisitedError(Exception):
48+
"""Exception raised when a symlink target has already been visited."""
49+
50+
def __init__(self, path: str) -> None:
51+
super().__init__(f"Symlink target already visited: {path}")

0 commit comments

Comments
 (0)