Coverage for typer / exceptions.py: 100%

13 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-11-18 11:12 +0000

1class TyperException(Exception): 1abcdefghij

2 """A Typer-specific exception""" 

3 

4 exit_code = 1 1abcdefghij

5 

6 def __init__(self, message: str) -> None: 1abcdefghij

7 super().__init__(message) 1abcdefghij

8 self.message = message 1abcdefghij

9 

10 def __str__(self) -> str: 1abcdefghij

11 return self.message # pragma: no cover 

12 

13 def format_message(self) -> str: 1abcdefghij

14 return self.message 1abcdefghij

15 

16 

17class Abort(RuntimeError): 1abcdefghij

18 """An internal signalling exception that signals Typer to abort.""" 

19 

20 

21class Exit(RuntimeError): 1abcdefghij

22 """An exception that indicates that the application should exit with some 

23 status code. 

24 """ 

25 

26 __slots__ = ("exit_code",) 1abcdefghij

27 

28 def __init__(self, code: int = 0) -> None: 1abcdefghij

29 self.exit_code: int = code 1abcdefghij