33__module__ = "tests.exceptions"
44
55class CommandExecutionError (RuntimeError ):
6+ """
7+ Exception raised when a command execution fails.
8+
9+ Attributes:
10+ message (str) -- Description of the error.
11+ exit_code (int) -- The exit code associated with the error.
12+
13+ Meta-Testing:
14+
15+ Testcase 1: Initialization with message and exit code.
16+ A. - Initializes the error.
17+ B. - checks inheritance.
18+ C. - checks each attribute.
19+
20+ >>> error = CommandExecutionError("Failed to execute command", exit_code=1)
21+ >>> isinstance(error, RuntimeError)
22+ True
23+ >>> error.message
24+ 'Failed to execute command'
25+ >>> error.exit_code
26+ 1
27+ """
28+
629 def __init__ (self , message , exit_code , * args , ** kwargs ):
30+ """
31+ Initialize CommandExecutionError with a message and exit code.
32+
33+ Parameters:
34+ message (str) -- Description of the error.
35+ exit_code (int) -- The exit code associated with the error.
36+ *args: Variable length argument list.
37+ **kwargs: Arbitrary keyword arguments.
38+
39+ Meta-Testing:
40+
41+ Testcase 1: Initialization with different exit code:
42+ A. - Initializes a CommandExecutionError with a specific exit code.
43+ B. - Checks the message is still set, as super class would.
44+ C. - check the specific exit code is 2.
45+
46+ >>> error = CommandExecutionError("Error message", 2)
47+ >>> error.message
48+ 'Error message'
49+ >>> error.exit_code
50+ 2
51+ """
752 super ().__init__ (message , * args , ** kwargs )
8- self .exit_code = exit_code
53+ self .exit_code = exit_code
54+
0 commit comments