Coverage for cogapp / errors.py: 100.00%

15 statements  

« prev     ^ index     » next       coverage.py v7.13.2, created at 2026-01-25 07:14 -0500

1from argparse import ArgumentTypeError 

2from typing import Any 

3 

4 

5class CogError(Exception): 

6 """Any exception raised by Cog.""" 

7 

8 def __init__(self, msg: Any, file: str = "", line: int = 0): 

9 if file: 

10 super().__init__(f"{file}({line}): {msg}") 

11 else: 

12 super().__init__(msg) 

13 

14 

15class CogUsageError(CogError, ArgumentTypeError): 

16 """An error in usage of command-line arguments in cog.""" 

17 

18 pass 

19 

20 

21class CogGeneratedError(CogError): 

22 """An error raised by a user's cog generator.""" 

23 

24 pass 

25 

26 

27class CogUserException(CogError): 

28 """An exception caught when running a user's cog generator. 

29 

30 The argument is the traceback message to print. 

31 

32 """ 

33 

34 pass 

35 

36 

37class CogCheckFailed(CogError): 

38 """A --check failed.""" 

39 

40 pass