Coverage for /Users/OORDCOR/Documents/code/bump-my-version/bumpversion/exceptions.py: 100%

22 statements  

« prev     ^ index     » next       coverage.py v7.3.2, created at 2024-02-24 07:45 -0600

1"""Custom exceptions for BumpVersion.""" 

2 

3from typing import Optional 

4 

5from click import Context, UsageError 

6 

7 

8class BumpVersionError(UsageError): 

9 """Custom base class for all BumpVersion exception types.""" 

10 

11 def __init__(self, message: str, ctx: Optional[Context] = None): 

12 self.message = message 

13 self.ctx = ctx 

14 

15 

16class FormattingError(BumpVersionError): 

17 """We are unable to represent a version required by a format.""" 

18 

19 pass 

20 

21 

22class MissingValueError(BumpVersionError): 

23 """A part required for a version format is empty.""" 

24 

25 pass 

26 

27 

28class DirtyWorkingDirectoryError(BumpVersionError): 

29 """The working directory is dirty, and it is not allowed.""" 

30 

31 pass 

32 

33 

34class SignedTagsError(BumpVersionError): 

35 """The VCS does not support signed tags.""" 

36 

37 pass 

38 

39 

40class VersionNotFoundError(BumpVersionError): 

41 """A version number was not found in a source file.""" 

42 

43 pass 

44 

45 

46class InvalidVersionPartError(BumpVersionError): 

47 """The specified part (e.g. 'bugfix') was not found.""" 

48 

49 pass 

50 

51 

52class ConfigurationError(BumpVersionError): 

53 """A configuration key-value is missing or in the wrong type.""" 

54 

55 pass 

56 

57 

58class BadInputError(BumpVersionError): 

59 """User input was bad.""" 

60 

61 pass