An error from creating or using an argument (optional or positional). The string value of this exception is the message, augmented with information about the argument that caused it.
| 703 | |
| 704 | |
| 705 | class ArgumentError(Exception): |
| 706 | """An error from creating or using an argument (optional or positional). |
| 707 | |
| 708 | The string value of this exception is the message, augmented with |
| 709 | information about the argument that caused it. |
| 710 | """ |
| 711 | |
| 712 | def __init__(self, argument, message): |
| 713 | self.argument_name = _get_action_name(argument) |
| 714 | self.message = message |
| 715 | |
| 716 | def __str__(self): |
| 717 | if self.argument_name is None: |
| 718 | format = '%(message)s' |
| 719 | else: |
| 720 | format = 'argument %(argument_name)s: %(message)s' |
| 721 | return format % dict(message=self.message, |
| 722 | argument_name=self.argument_name) |
| 723 | |
| 724 | |
| 725 | class ArgumentTypeError(Exception): |
no outgoing calls
no test coverage detected