Skip to content
Myr

Errors now go to stderr. This fixes #103

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent 88c97ef · Browse files · 2 files+7 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+7 added−1 removed

  • other:+7 added−1 removed

2 files+7 added−1 removed

modified:click/exceptions.py+6 added-1 removed
1import sys1from ._compat import PY2, filename_to_ui2from ._compat import PY2, filename_to_ui, get_text_stderr3from .utils import echo456class ClickException(Exception):
12 unmodified lines
19 def format_message(self):20 return self.message2122 def show(self, file=None):23 if file is None:24 file = get_text_stderr()25 echo('Error: %s' % self.format_message())262728class UsageError(ClickException):
10 unmodified lines
39 ClickException.__init__(self, message)40 self.ctx = ctx4142 def show(self, file=None):43 if file is None:44 file = get_text_stderr()45 if self.ctx is not None:46 echo(self.ctx.get_usage() + '\n', file=file)47 echo('Error: %s' % self.format_message(), file=file)48
54 unmodified lines
modified:CHANGES+1 added
31 unmodified lines
32- setting a default for arguments now implicitly makes it non required.33- changed "yN" / "Yn" to "y/N" and "Y/n" in confirmation prompts.34- added basic support for bash completion.35- added :func:`getchar` to fetch a single character from the terminal.36- errors now go to stderr as intended.3738Version 1.139-----------40
11 unmodified lines