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

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

2 from typing import Optional

3

4 from click import Context, UsageError

5

6

7 class BumpVersionError(UsageError):

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

9

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

11 self.message = message

12 self.ctx = ctx

13

14

15 class FormattingError(BumpVersionError):

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

17

18 pass

19

20

21 class MissingValueError(BumpVersionError):

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

23

24 pass

25

26

27 class DirtyWorkingDirectoryError(BumpVersionError):

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

29

30 pass

31

32

33 class SignedTagsError(BumpVersionError):

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

35

36 pass

37

38

39 class VersionNotFoundError(BumpVersionError):

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

41

42 pass

43

44

45 class InvalidVersionPartError(BumpVersionError):

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

47

48 pass

49

50

51 class ConfigurationError(BumpVersionError):

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

53

54 pass

55

56

57 class BadInputError(BumpVersionError):

58 """User input was bad."""

59

60 pass