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

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

2

3 from typing import Optional

4

5 from click import Context, UsageError

6

7

8 class 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

16 class FormattingError(BumpVersionError):

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

18

19 pass

20

21

22 class MissingValueError(BumpVersionError):

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

24

25 pass

26

27

28 class DirtyWorkingDirectoryError(BumpVersionError):

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

30

31 pass

32

33

34 class SignedTagsError(BumpVersionError):

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

36

37 pass

38

39

40 class VersionNotFoundError(BumpVersionError):

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

42

43 pass

44

45

46 class InvalidVersionPartError(BumpVersionError):

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

48

49 pass

50

51

52 class ConfigurationError(BumpVersionError):

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

54

55 pass

56

57

58 class BadInputError(BumpVersionError):

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

60

61 pass