We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
ClickException message goes to stdout instead of stderr with version 7.1
Thanks a lot for ``click`` - absolutely fantastic project. 

I've noticed the following change when upgrading to 7.1, and am not sure if it's intentional or not:

### Expected Behavior

When raising ``click.ClickException``, the corresponding ``Error: <message>`` goes to ``stderr`` using click version 7.0.

Minimal reproducing code:

```python
import click

@click.command()
def run():
    raise click.ClickException('exception message')

if __name__ == '__main__':
    run()
```
```bash
python <filename>.py 1> stdout 2> stderr
```

### Actual Behavior

With version 7.1, the ``Error: exception message`` ends up in ``stdout`` instead of ``stderr``.

### Environment

* Python version: Python 3.7.5
* Click version: 7.1
* OS: Ubuntu 18.04 [through WSL1]
* Shell: GNU bash, version 4.4.20

### Additional comments

As mentioned above I'm not sure if this is an intended change, but I couldn't find any mention on the [Changelog](https://click.palletsprojects.com/en/7.x/changelog/#version-7-1), and [this part](https://click.palletsprojects.com/en/7.x/exceptions/#which-exceptions-exist) of the docs still referes to ``show`` being printed to ``stderr``.

Happy to do some more digging if this happens only on my system.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/click/exceptions.py`
Content:
```
1 from ._compat import filename_to_ui
2 from ._compat import get_text_stderr
3 from ._compat import PY2
4 from .utils import echo
5 
6 
7 def _join_param_hints(param_hint):
8     if isinstance(param_hint, (tuple, list)):
9         return " / ".join(repr(x) for x in param_hint)
10     return param_hint
11 
12 
13 class ClickException(Exception):
14     """An exception that Click can handle and show to the user."""
15 
16     #: The exit code for this exception
17     exit_code = 1
18 
19     def __init__(self, message):
20         ctor_msg = message
21         if PY2:
22             if ctor_msg is not None:
23                 ctor_msg = ctor_msg.encode("utf-8")
24         Exception.__init__(self, ctor_msg)
25         self.message = message
26 
27     def format_message(self):
28         return self.message
29 
30     def __str__(self):
31         return self.message
32 
33     if PY2:
34         __unicode__ = __str__
35 
36         def __str__(self):
37             return self.message.encode("utf-8")
38 
39     def show(self, file=None):
40         if file is None:
41             file = get_text_stderr()
42         echo("Error: {}".format(self.format_message(), file=file))
43 
44 
45 class UsageError(ClickException):
46     """An internal exception that signals a usage error.  This typically
47     aborts any further handling.
48 
49     :param message: the error message to display.
50     :param ctx: optionally the context that caused this error.  Click will
51                 fill in the context automatically in some situations.
52     """
53 
54     exit_code = 2
55 
56     def __init__(self, message, ctx=None):
57         ClickException.__init__(self, message)
58         self.ctx = ctx
59         self.cmd = self.ctx.command if self.ctx else None
60 
61     def show(self, file=None):
62         if file is None:
63             file = get_text_stderr()
64         color = None
65         hint = ""
66         if self.cmd is not None and self.cmd.get_help_option(self.ctx) is not None:
67             hint = "Try '{} {}' for help.\n".format(
68                 self.ctx.command_path, self.ctx.help_option_names[0]
69             )
70         if self.ctx is not None:
71             color = self.ctx.color
72             echo("{}\n{}".format(self.ctx.get_usage(), hint), file=file, color=color)
73         echo("Error: {}".format(self.format_message()), file=file, color=color)
74 
75 
76 class BadParameter(UsageError):
77     """An exception that formats out a standardized error message for a
78     bad parameter.  This is useful when thrown from a callback or type as
79     Click will attach contextual information to it (for instance, which
80     parameter it is).
81 
82     .. versionadded:: 2.0
83 
84     :param param: the parameter object that caused this error.  This can
85                   be left out, and Click will attach this info itself
86                   if possible.
87     :param param_hint: a string that shows up as parameter name.  This
88                        can be used as alternative to `param` in cases
89                        where custom validation should happen.  If it is
90                        a string it's used as such, if it's a list then
91                        each item is quoted and separated.
92     """
93 
94     def __init__(self, message, ctx=None, param=None, param_hint=None):
95         UsageError.__init__(self, message, ctx)
96         self.param = param
97         self.param_hint = param_hint
98 
99     def format_message(self):
100         if self.param_hint is not None:
101             param_hint = self.param_hint
102         elif self.param is not None:
103             param_hint = self.param.get_error_hint(self.ctx)
104         else:
105             return "Invalid value: {}".format(self.message)
106         param_hint = _join_param_hints(param_hint)
107 
108         return "Invalid value for {}: {}".format(param_hint, self.message)
109 
110 
111 class MissingParameter(BadParameter):
112     """Raised if click required an option or argument but it was not
113     provided when invoking the script.
114 
115     .. versionadded:: 4.0
116 
117     :param param_type: a string that indicates the type of the parameter.
118                        The default is to inherit the parameter type from
119                        the given `param`.  Valid values are ``'parameter'``,
120                        ``'option'`` or ``'argument'``.
121     """
122 
123     def __init__(
124         self, message=None, ctx=None, param=None, param_hint=None, param_type=None
125     ):
126         BadParameter.__init__(self, message, ctx, param, param_hint)
127         self.param_type = param_type
128 
129     def format_message(self):
130         if self.param_hint is not None:
131             param_hint = self.param_hint
132         elif self.param is not None:
133             param_hint = self.param.get_error_hint(self.ctx)
134         else:
135             param_hint = None
136         param_hint = _join_param_hints(param_hint)
137 
138         param_type = self.param_type
139         if param_type is None and self.param is not None:
140             param_type = self.param.param_type_name
141 
142         msg = self.message
143         if self.param is not None:
144             msg_extra = self.param.type.get_missing_message(self.param)
145             if msg_extra:
146                 if msg:
147                     msg += ".  {}".format(msg_extra)
148                 else:
149                     msg = msg_extra
150 
151         return "Missing {}{}{}{}".format(
152             param_type,
153             " {}".format(param_hint) if param_hint else "",
154             ".  " if msg else ".",
155             msg or "",
156         )
157 
158     def __str__(self):
159         if self.message is None:
160             param_name = self.param.name if self.param else None
161             return "missing parameter: {}".format(param_name)
162         else:
163             return self.message
164 
165     if PY2:
166         __unicode__ = __str__
167 
168         def __str__(self):
169             return self.__unicode__().encode("utf-8")
170 
171 
172 class NoSuchOption(UsageError):
173     """Raised if click attempted to handle an option that does not
174     exist.
175 
176     .. versionadded:: 4.0
177     """
178 
179     def __init__(self, option_name, message=None, possibilities=None, ctx=None):
180         if message is None:
181             message = "no such option: {}".format(option_name)
182         UsageError.__init__(self, message, ctx)
183         self.option_name = option_name
184         self.possibilities = possibilities
185 
186     def format_message(self):
187         bits = [self.message]
188         if self.possibilities:
189             if len(self.possibilities) == 1:
190                 bits.append("Did you mean {}?".format(self.possibilities[0]))
191             else:
192                 possibilities = sorted(self.possibilities)
193                 bits.append("(Possible options: {})".format(", ".join(possibilities)))
194         return "  ".join(bits)
195 
196 
197 class BadOptionUsage(UsageError):
198     """Raised if an option is generally supplied but the use of the option
199     was incorrect.  This is for instance raised if the number of arguments
200     for an option is not correct.
201 
202     .. versionadded:: 4.0
203 
204     :param option_name: the name of the option being used incorrectly.
205     """
206 
207     def __init__(self, option_name, message, ctx=None):
208         UsageError.__init__(self, message, ctx)
209         self.option_name = option_name
210 
211 
212 class BadArgumentUsage(UsageError):
213     """Raised if an argument is generally supplied but the use of the argument
214     was incorrect.  This is for instance raised if the number of values
215     for an argument is not correct.
216 
217     .. versionadded:: 6.0
218     """
219 
220     def __init__(self, message, ctx=None):
221         UsageError.__init__(self, message, ctx)
222 
223 
224 class FileError(ClickException):
225     """Raised if a file cannot be opened."""
226 
227     def __init__(self, filename, hint=None):
228         ui_filename = filename_to_ui(filename)
229         if hint is None:
230             hint = "unknown error"
231         ClickException.__init__(self, hint)
232         self.ui_filename = ui_filename
233         self.filename = filename
234 
235     def format_message(self):
236         return "Could not open file {}: {}".format(self.ui_filename, self.message)
237 
238 
239 class Abort(RuntimeError):
240     """An internal signalling exception that signals Click to abort."""
241 
242 
243 class Exit(RuntimeError):
244     """An exception that indicates that the application should exit with some
245     status code.
246 
247     :param code: the status code to exit with.
248     """
249 
250     __slots__ = ("exit_code",)
251 
252     def __init__(self, code=0):
253         self.exit_code = code
254
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/click/exceptions.py b/src/click/exceptions.py
--- a/src/click/exceptions.py
+++ b/src/click/exceptions.py
@@ -39,7 +39,7 @@
     def show(self, file=None):
         if file is None:
             file = get_text_stderr()
-        echo("Error: {}".format(self.format_message(), file=file))
+        echo("Error: {}".format(self.format_message()), file=file)
 
 
 class UsageError(ClickException):

{"golden_diff": "diff --git a/src/click/exceptions.py b/src/click/exceptions.py\n--- a/src/click/exceptions.py\n+++ b/src/click/exceptions.py\n@@ -39,7 +39,7 @@\n     def show(self, file=None):\n         if file is None:\n             file = get_text_stderr()\n-        echo(\"Error: {}\".format(self.format_message(), file=file))\n+        echo(\"Error: {}\".format(self.format_message()), file=file)\n \n \n class UsageError(ClickException):\n", "issue": "ClickException message goes to stdout instead of stderr with version 7.1\nThanks a lot for ``click`` - absolutely fantastic project. \r\n\r\nI've noticed the following change when upgrading to 7.1, and am not sure if it's intentional or not:\r\n\r\n### Expected Behavior\r\n\r\nWhen raising ``click.ClickException``, the corresponding ``Error: <message>`` goes to ``stderr`` using click version 7.0.\r\n\r\nMinimal reproducing code:\r\n\r\n```python\r\nimport click\r\n\r\n@click.command()\r\ndef run():\r\n    raise click.ClickException('exception message')\r\n\r\nif __name__ == '__main__':\r\n    run()\r\n```\r\n```bash\r\npython <filename>.py 1> stdout 2> stderr\r\n```\r\n\r\n### Actual Behavior\r\n\r\nWith version 7.1, the ``Error: exception message`` ends up in ``stdout`` instead of ``stderr``.\r\n\r\n### Environment\r\n\r\n* Python version: Python 3.7.5\r\n* Click version: 7.1\r\n* OS: Ubuntu 18.04 [through WSL1]\r\n* Shell: GNU bash, version 4.4.20\r\n\r\n### Additional comments\r\n\r\nAs mentioned above I'm not sure if this is an intended change, but I couldn't find any mention on the [Changelog](https://click.palletsprojects.com/en/7.x/changelog/#version-7-1), and [this part](https://click.palletsprojects.com/en/7.x/exceptions/#which-exceptions-exist) of the docs still referes to ``show`` being printed to ``stderr``.\r\n\r\nHappy to do some more digging if this happens only on my system.\r\n\n", "before_files": [{"content": "from ._compat import filename_to_ui\nfrom ._compat import get_text_stderr\nfrom ._compat import PY2\nfrom .utils import echo\n\n\ndef _join_param_hints(param_hint):\n    if isinstance(param_hint, (tuple, list)):\n        return \" / \".join(repr(x) for x in param_hint)\n    return param_hint\n\n\nclass ClickException(Exception):\n    \"\"\"An exception that Click can handle and show to the user.\"\"\"\n\n    #: The exit code for this exception\n    exit_code = 1\n\n    def __init__(self, message):\n        ctor_msg = message\n        if PY2:\n            if ctor_msg is not None:\n                ctor_msg = ctor_msg.encode(\"utf-8\")\n        Exception.__init__(self, ctor_msg)\n        self.message = message\n\n    def format_message(self):\n        return self.message\n\n    def __str__(self):\n        return self.message\n\n    if PY2:\n        __unicode__ = __str__\n\n        def __str__(self):\n            return self.message.encode(\"utf-8\")\n\n    def show(self, file=None):\n        if file is None:\n            file = get_text_stderr()\n        echo(\"Error: {}\".format(self.format_message(), file=file))\n\n\nclass UsageError(ClickException):\n    \"\"\"An internal exception that signals a usage error.  This typically\n    aborts any further handling.\n\n    :param message: the error message to display.\n    :param ctx: optionally the context that caused this error.  Click will\n                fill in the context automatically in some situations.\n    \"\"\"\n\n    exit_code = 2\n\n    def __init__(self, message, ctx=None):\n        ClickException.__init__(self, message)\n        self.ctx = ctx\n        self.cmd = self.ctx.command if self.ctx else None\n\n    def show(self, file=None):\n        if file is None:\n            file = get_text_stderr()\n        color = None\n        hint = \"\"\n        if self.cmd is not None and self.cmd.get_help_option(self.ctx) is not None:\n            hint = \"Try '{} {}' for help.\\n\".format(\n                self.ctx.command_path, self.ctx.help_option_names[0]\n            )\n        if self.ctx is not None:\n            color = self.ctx.color\n            echo(\"{}\\n{}\".format(self.ctx.get_usage(), hint), file=file, color=color)\n        echo(\"Error: {}\".format(self.format_message()), file=file, color=color)\n\n\nclass BadParameter(UsageError):\n    \"\"\"An exception that formats out a standardized error message for a\n    bad parameter.  This is useful when thrown from a callback or type as\n    Click will attach contextual information to it (for instance, which\n    parameter it is).\n\n    .. versionadded:: 2.0\n\n    :param param: the parameter object that caused this error.  This can\n                  be left out, and Click will attach this info itself\n                  if possible.\n    :param param_hint: a string that shows up as parameter name.  This\n                       can be used as alternative to `param` in cases\n                       where custom validation should happen.  If it is\n                       a string it's used as such, if it's a list then\n                       each item is quoted and separated.\n    \"\"\"\n\n    def __init__(self, message, ctx=None, param=None, param_hint=None):\n        UsageError.__init__(self, message, ctx)\n        self.param = param\n        self.param_hint = param_hint\n\n    def format_message(self):\n        if self.param_hint is not None:\n            param_hint = self.param_hint\n        elif self.param is not None:\n            param_hint = self.param.get_error_hint(self.ctx)\n        else:\n            return \"Invalid value: {}\".format(self.message)\n        param_hint = _join_param_hints(param_hint)\n\n        return \"Invalid value for {}: {}\".format(param_hint, self.message)\n\n\nclass MissingParameter(BadParameter):\n    \"\"\"Raised if click required an option or argument but it was not\n    provided when invoking the script.\n\n    .. versionadded:: 4.0\n\n    :param param_type: a string that indicates the type of the parameter.\n                       The default is to inherit the parameter type from\n                       the given `param`.  Valid values are ``'parameter'``,\n                       ``'option'`` or ``'argument'``.\n    \"\"\"\n\n    def __init__(\n        self, message=None, ctx=None, param=None, param_hint=None, param_type=None\n    ):\n        BadParameter.__init__(self, message, ctx, param, param_hint)\n        self.param_type = param_type\n\n    def format_message(self):\n        if self.param_hint is not None:\n            param_hint = self.param_hint\n        elif self.param is not None:\n            param_hint = self.param.get_error_hint(self.ctx)\n        else:\n            param_hint = None\n        param_hint = _join_param_hints(param_hint)\n\n        param_type = self.param_type\n        if param_type is None and self.param is not None:\n            param_type = self.param.param_type_name\n\n        msg = self.message\n        if self.param is not None:\n            msg_extra = self.param.type.get_missing_message(self.param)\n            if msg_extra:\n                if msg:\n                    msg += \".  {}\".format(msg_extra)\n                else:\n                    msg = msg_extra\n\n        return \"Missing {}{}{}{}\".format(\n            param_type,\n            \" {}\".format(param_hint) if param_hint else \"\",\n            \".  \" if msg else \".\",\n            msg or \"\",\n        )\n\n    def __str__(self):\n        if self.message is None:\n            param_name = self.param.name if self.param else None\n            return \"missing parameter: {}\".format(param_name)\n        else:\n            return self.message\n\n    if PY2:\n        __unicode__ = __str__\n\n        def __str__(self):\n            return self.__unicode__().encode(\"utf-8\")\n\n\nclass NoSuchOption(UsageError):\n    \"\"\"Raised if click attempted to handle an option that does not\n    exist.\n\n    .. versionadded:: 4.0\n    \"\"\"\n\n    def __init__(self, option_name, message=None, possibilities=None, ctx=None):\n        if message is None:\n            message = \"no such option: {}\".format(option_name)\n        UsageError.__init__(self, message, ctx)\n        self.option_name = option_name\n        self.possibilities = possibilities\n\n    def format_message(self):\n        bits = [self.message]\n        if self.possibilities:\n            if len(self.possibilities) == 1:\n                bits.append(\"Did you mean {}?\".format(self.possibilities[0]))\n            else:\n                possibilities = sorted(self.possibilities)\n                bits.append(\"(Possible options: {})\".format(\", \".join(possibilities)))\n        return \"  \".join(bits)\n\n\nclass BadOptionUsage(UsageError):\n    \"\"\"Raised if an option is generally supplied but the use of the option\n    was incorrect.  This is for instance raised if the number of arguments\n    for an option is not correct.\n\n    .. versionadded:: 4.0\n\n    :param option_name: the name of the option being used incorrectly.\n    \"\"\"\n\n    def __init__(self, option_name, message, ctx=None):\n        UsageError.__init__(self, message, ctx)\n        self.option_name = option_name\n\n\nclass BadArgumentUsage(UsageError):\n    \"\"\"Raised if an argument is generally supplied but the use of the argument\n    was incorrect.  This is for instance raised if the number of values\n    for an argument is not correct.\n\n    .. versionadded:: 6.0\n    \"\"\"\n\n    def __init__(self, message, ctx=None):\n        UsageError.__init__(self, message, ctx)\n\n\nclass FileError(ClickException):\n    \"\"\"Raised if a file cannot be opened.\"\"\"\n\n    def __init__(self, filename, hint=None):\n        ui_filename = filename_to_ui(filename)\n        if hint is None:\n            hint = \"unknown error\"\n        ClickException.__init__(self, hint)\n        self.ui_filename = ui_filename\n        self.filename = filename\n\n    def format_message(self):\n        return \"Could not open file {}: {}\".format(self.ui_filename, self.message)\n\n\nclass Abort(RuntimeError):\n    \"\"\"An internal signalling exception that signals Click to abort.\"\"\"\n\n\nclass Exit(RuntimeError):\n    \"\"\"An exception that indicates that the application should exit with some\n    status code.\n\n    :param code: the status code to exit with.\n    \"\"\"\n\n    __slots__ = (\"exit_code\",)\n\n    def __init__(self, code=0):\n        self.exit_code = code\n", "path": "src/click/exceptions.py"}], "after_files": [{"content": "from ._compat import filename_to_ui\nfrom ._compat import get_text_stderr\nfrom ._compat import PY2\nfrom .utils import echo\n\n\ndef _join_param_hints(param_hint):\n    if isinstance(param_hint, (tuple, list)):\n        return \" / \".join(repr(x) for x in param_hint)\n    return param_hint\n\n\nclass ClickException(Exception):\n    \"\"\"An exception that Click can handle and show to the user.\"\"\"\n\n    #: The exit code for this exception\n    exit_code = 1\n\n    def __init__(self, message):\n        ctor_msg = message\n        if PY2:\n            if ctor_msg is not None:\n                ctor_msg = ctor_msg.encode(\"utf-8\")\n        Exception.__init__(self, ctor_msg)\n        self.message = message\n\n    def format_message(self):\n        return self.message\n\n    def __str__(self):\n        return self.message\n\n    if PY2:\n        __unicode__ = __str__\n\n        def __str__(self):\n            return self.message.encode(\"utf-8\")\n\n    def show(self, file=None):\n        if file is None:\n            file = get_text_stderr()\n        echo(\"Error: {}\".format(self.format_message()), file=file)\n\n\nclass UsageError(ClickException):\n    \"\"\"An internal exception that signals a usage error.  This typically\n    aborts any further handling.\n\n    :param message: the error message to display.\n    :param ctx: optionally the context that caused this error.  Click will\n                fill in the context automatically in some situations.\n    \"\"\"\n\n    exit_code = 2\n\n    def __init__(self, message, ctx=None):\n        ClickException.__init__(self, message)\n        self.ctx = ctx\n        self.cmd = self.ctx.command if self.ctx else None\n\n    def show(self, file=None):\n        if file is None:\n            file = get_text_stderr()\n        color = None\n        hint = \"\"\n        if self.cmd is not None and self.cmd.get_help_option(self.ctx) is not None:\n            hint = \"Try '{} {}' for help.\\n\".format(\n                self.ctx.command_path, self.ctx.help_option_names[0]\n            )\n        if self.ctx is not None:\n            color = self.ctx.color\n            echo(\"{}\\n{}\".format(self.ctx.get_usage(), hint), file=file, color=color)\n        echo(\"Error: {}\".format(self.format_message()), file=file, color=color)\n\n\nclass BadParameter(UsageError):\n    \"\"\"An exception that formats out a standardized error message for a\n    bad parameter.  This is useful when thrown from a callback or type as\n    Click will attach contextual information to it (for instance, which\n    parameter it is).\n\n    .. versionadded:: 2.0\n\n    :param param: the parameter object that caused this error.  This can\n                  be left out, and Click will attach this info itself\n                  if possible.\n    :param param_hint: a string that shows up as parameter name.  This\n                       can be used as alternative to `param` in cases\n                       where custom validation should happen.  If it is\n                       a string it's used as such, if it's a list then\n                       each item is quoted and separated.\n    \"\"\"\n\n    def __init__(self, message, ctx=None, param=None, param_hint=None):\n        UsageError.__init__(self, message, ctx)\n        self.param = param\n        self.param_hint = param_hint\n\n    def format_message(self):\n        if self.param_hint is not None:\n            param_hint = self.param_hint\n        elif self.param is not None:\n            param_hint = self.param.get_error_hint(self.ctx)\n        else:\n            return \"Invalid value: {}\".format(self.message)\n        param_hint = _join_param_hints(param_hint)\n\n        return \"Invalid value for {}: {}\".format(param_hint, self.message)\n\n\nclass MissingParameter(BadParameter):\n    \"\"\"Raised if click required an option or argument but it was not\n    provided when invoking the script.\n\n    .. versionadded:: 4.0\n\n    :param param_type: a string that indicates the type of the parameter.\n                       The default is to inherit the parameter type from\n                       the given `param`.  Valid values are ``'parameter'``,\n                       ``'option'`` or ``'argument'``.\n    \"\"\"\n\n    def __init__(\n        self, message=None, ctx=None, param=None, param_hint=None, param_type=None\n    ):\n        BadParameter.__init__(self, message, ctx, param, param_hint)\n        self.param_type = param_type\n\n    def format_message(self):\n        if self.param_hint is not None:\n            param_hint = self.param_hint\n        elif self.param is not None:\n            param_hint = self.param.get_error_hint(self.ctx)\n        else:\n            param_hint = None\n        param_hint = _join_param_hints(param_hint)\n\n        param_type = self.param_type\n        if param_type is None and self.param is not None:\n            param_type = self.param.param_type_name\n\n        msg = self.message\n        if self.param is not None:\n            msg_extra = self.param.type.get_missing_message(self.param)\n            if msg_extra:\n                if msg:\n                    msg += \".  {}\".format(msg_extra)\n                else:\n                    msg = msg_extra\n\n        return \"Missing {}{}{}{}\".format(\n            param_type,\n            \" {}\".format(param_hint) if param_hint else \"\",\n            \".  \" if msg else \".\",\n            msg or \"\",\n        )\n\n    def __str__(self):\n        if self.message is None:\n            param_name = self.param.name if self.param else None\n            return \"missing parameter: {}\".format(param_name)\n        else:\n            return self.message\n\n    if PY2:\n        __unicode__ = __str__\n\n        def __str__(self):\n            return self.__unicode__().encode(\"utf-8\")\n\n\nclass NoSuchOption(UsageError):\n    \"\"\"Raised if click attempted to handle an option that does not\n    exist.\n\n    .. versionadded:: 4.0\n    \"\"\"\n\n    def __init__(self, option_name, message=None, possibilities=None, ctx=None):\n        if message is None:\n            message = \"no such option: {}\".format(option_name)\n        UsageError.__init__(self, message, ctx)\n        self.option_name = option_name\n        self.possibilities = possibilities\n\n    def format_message(self):\n        bits = [self.message]\n        if self.possibilities:\n            if len(self.possibilities) == 1:\n                bits.append(\"Did you mean {}?\".format(self.possibilities[0]))\n            else:\n                possibilities = sorted(self.possibilities)\n                bits.append(\"(Possible options: {})\".format(\", \".join(possibilities)))\n        return \"  \".join(bits)\n\n\nclass BadOptionUsage(UsageError):\n    \"\"\"Raised if an option is generally supplied but the use of the option\n    was incorrect.  This is for instance raised if the number of arguments\n    for an option is not correct.\n\n    .. versionadded:: 4.0\n\n    :param option_name: the name of the option being used incorrectly.\n    \"\"\"\n\n    def __init__(self, option_name, message, ctx=None):\n        UsageError.__init__(self, message, ctx)\n        self.option_name = option_name\n\n\nclass BadArgumentUsage(UsageError):\n    \"\"\"Raised if an argument is generally supplied but the use of the argument\n    was incorrect.  This is for instance raised if the number of values\n    for an argument is not correct.\n\n    .. versionadded:: 6.0\n    \"\"\"\n\n    def __init__(self, message, ctx=None):\n        UsageError.__init__(self, message, ctx)\n\n\nclass FileError(ClickException):\n    \"\"\"Raised if a file cannot be opened.\"\"\"\n\n    def __init__(self, filename, hint=None):\n        ui_filename = filename_to_ui(filename)\n        if hint is None:\n            hint = \"unknown error\"\n        ClickException.__init__(self, hint)\n        self.ui_filename = ui_filename\n        self.filename = filename\n\n    def format_message(self):\n        return \"Could not open file {}: {}\".format(self.ui_filename, self.message)\n\n\nclass Abort(RuntimeError):\n    \"\"\"An internal signalling exception that signals Click to abort.\"\"\"\n\n\nclass Exit(RuntimeError):\n    \"\"\"An exception that indicates that the application should exit with some\n    status code.\n\n    :param code: the status code to exit with.\n    \"\"\"\n\n    __slots__ = (\"exit_code\",)\n\n    def __init__(self, code=0):\n        self.exit_code = code\n", "path": "src/click/exceptions.py"}]}