Coverage for src / docstring_format_checker / utils / exceptions.py: 100%
18 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-25 08:09 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-25 08:09 +0000
1# ============================================================================ #
2# #
3# Title: Exceptions Module for Docstring Format Checker #
4# Purpose: Custom exceptions for error handling in the docstring format #
5# checker. #
6# #
7# ============================================================================ #
10# ---------------------------------------------------------------------------- #
11# #
12# Overview ####
13# #
14# ---------------------------------------------------------------------------- #
17# ---------------------------------------------------------------------------- #
18# Description ####
19# ---------------------------------------------------------------------------- #
22"""
23!!! note "Summary"
24 This module defines custom exceptions for handling various error scenarios
25"""
28# ---------------------------------------------------------------------------- #
29# #
30# Main Section ####
31# #
32# ---------------------------------------------------------------------------- #
35class DocstringError(Exception):
36 """
37 !!! note "Summary"
38 Exception raised when a docstring validation error occurs.
39 """
41 def __init__(
42 self,
43 message: str,
44 file_path: str,
45 line_number: int,
46 item_name: str,
47 item_type: str,
48 ) -> None:
49 """
50 !!! note "Summary"
51 Initialize a DocstringError.
52 """
53 self.message: str = message
54 self.file_path: str = file_path
55 self.line_number: int = line_number
56 self.item_name: str = item_name
57 self.item_type: str = item_type
58 super().__init__(f"Line {line_number}, {item_type} '{item_name}': {message}")
61class InvalidConfigError(Exception):
62 """
63 !!! note "Summary"
64 Exception raised for invalid configuration errors.
65 """
67 pass
70class InvalidConfigError_DuplicateOrderValues(Exception):
71 """
72 !!! note "Summary"
73 Exception raised for duplicate order values in configuration.
74 """
76 pass
79class InvalidTypeValuesError(Exception):
80 """
81 !!! note "Summary"
82 Exception raised for invalid type values in configuration.
83 """
85 pass
88class InvalidFileError(OSError):
89 """
90 !!! note "Summary"
91 Exception raised for invalid file errors.
92 """
94 pass
97class DirectoryNotFoundError(OSError):
98 """
99 !!! note "Summary"
100 Exception raised for directory not found errors.
101 """
103 pass