We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
asyncio.exceptions.CancelledError On Windows OS
The following exception raised when running the hello world example on Windows with Microsoft store version of Python 3.9.

WSL2 environment does not reproduce the issue.

```
from sanic import Sanic
from sanic.response import json

app = Sanic("My Hello, world app")

@app.route('/')
async def test(request):
    return json({'hello': 'world'})

if __name__ == '__main__':
    app.run()
```

```
[2021-06-30 23:00:05 -0700] [12184] [INFO] Goin' Fast @ http://127.0.0.1:8000
[2021-06-30 23:00:06 -0700] [12184] [INFO] Starting worker [12184]
[2021-06-30 23:00:11 -0700] - (sanic.access)[INFO][127.0.0.1:53159]: GET http://127.0.0.1:8000/  200 17
[2021-06-30 23:01:11 -0700] [12184] [ERROR] Exception occurred while handling uri: 'http:///*'
Traceback (most recent call last):
  File "C:\Users\zhiwe\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\sanic\http.py", line 126, in http1
    await self.http1_request_header()
  File "C:\Users\zhiwe\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\sanic\http.py", line 188, in http1_request_header      
    await self._receive_more()
  File "C:\Users\zhiwe\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\sanic\server.py", line 222, in receive_more
    await self._data_received.wait()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64__qbz5n2kfra8p0\lib\asyncio\locks.py", line 226, in wait
    await fut
asyncio.exceptions.CancelledError
[2021-06-30 23:01:11 -0700] - (sanic.access)[INFO][UNKNOWN]: NONE http:///*  408 664
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `sanic/exceptions.py`
Content:
```
1 from typing import Optional, Union
2 
3 from sanic.helpers import STATUS_CODES
4 
5 
6 class SanicException(Exception):
7     def __init__(
8         self,
9         message: Optional[Union[str, bytes]] = None,
10         status_code: Optional[int] = None,
11         quiet: Optional[bool] = None,
12     ) -> None:
13 
14         if message is None and status_code is not None:
15             msg: bytes = STATUS_CODES.get(status_code, b"")
16             message = msg.decode("utf8")
17 
18         super().__init__(message)
19 
20         if status_code is not None:
21             self.status_code = status_code
22 
23         # quiet=None/False/True with None meaning choose by status
24         if quiet or quiet is None and status_code not in (None, 500):
25             self.quiet = True
26 
27 
28 class NotFound(SanicException):
29     """
30     **Status**: 404 Not Found
31     """
32 
33     status_code = 404
34 
35 
36 class InvalidUsage(SanicException):
37     """
38     **Status**: 400 Bad Request
39     """
40 
41     status_code = 400
42 
43 
44 class MethodNotSupported(SanicException):
45     """
46     **Status**: 405 Method Not Allowed
47     """
48 
49     status_code = 405
50 
51     def __init__(self, message, method, allowed_methods):
52         super().__init__(message)
53         self.headers = {"Allow": ", ".join(allowed_methods)}
54 
55 
56 class ServerError(SanicException):
57     """
58     **Status**: 500 Internal Server Error
59     """
60 
61     status_code = 500
62 
63 
64 class ServiceUnavailable(SanicException):
65     """
66     **Status**: 503 Service Unavailable
67 
68     The server is currently unavailable (because it is overloaded or
69     down for maintenance). Generally, this is a temporary state.
70     """
71 
72     status_code = 503
73 
74 
75 class URLBuildError(ServerError):
76     """
77     **Status**: 500 Internal Server Error
78     """
79 
80     status_code = 500
81 
82 
83 class FileNotFound(NotFound):
84     """
85     **Status**: 404 Not Found
86     """
87 
88     def __init__(self, message, path, relative_url):
89         super().__init__(message)
90         self.path = path
91         self.relative_url = relative_url
92 
93 
94 class RequestTimeout(SanicException):
95     """The Web server (running the Web site) thinks that there has been too
96     long an interval of time between 1) the establishment of an IP
97     connection (socket) between the client and the server and
98     2) the receipt of any data on that socket, so the server has dropped
99     the connection. The socket connection has actually been lost - the Web
100     server has 'timed out' on that particular socket connection.
101     """
102 
103     status_code = 408
104 
105 
106 class PayloadTooLarge(SanicException):
107     """
108     **Status**: 413 Payload Too Large
109     """
110 
111     status_code = 413
112 
113 
114 class HeaderNotFound(InvalidUsage):
115     """
116     **Status**: 400 Bad Request
117     """
118 
119     status_code = 400
120 
121 
122 class ContentRangeError(SanicException):
123     """
124     **Status**: 416 Range Not Satisfiable
125     """
126 
127     status_code = 416
128 
129     def __init__(self, message, content_range):
130         super().__init__(message)
131         self.headers = {"Content-Range": f"bytes */{content_range.total}"}
132 
133 
134 class HeaderExpectationFailed(SanicException):
135     """
136     **Status**: 417 Expectation Failed
137     """
138 
139     status_code = 417
140 
141 
142 class Forbidden(SanicException):
143     """
144     **Status**: 403 Forbidden
145     """
146 
147     status_code = 403
148 
149 
150 class InvalidRangeType(ContentRangeError):
151     """
152     **Status**: 416 Range Not Satisfiable
153     """
154 
155     status_code = 416
156 
157 
158 class PyFileError(Exception):
159     def __init__(self, file):
160         super().__init__("could not execute config file %s", file)
161 
162 
163 class Unauthorized(SanicException):
164     """
165     **Status**: 401 Unauthorized
166 
167     :param message: Message describing the exception.
168     :param status_code: HTTP Status code.
169     :param scheme: Name of the authentication scheme to be used.
170 
171     When present, kwargs is used to complete the WWW-Authentication header.
172 
173     Examples::
174 
175         # With a Basic auth-scheme, realm MUST be present:
176         raise Unauthorized("Auth required.",
177                            scheme="Basic",
178                            realm="Restricted Area")
179 
180         # With a Digest auth-scheme, things are a bit more complicated:
181         raise Unauthorized("Auth required.",
182                            scheme="Digest",
183                            realm="Restricted Area",
184                            qop="auth, auth-int",
185                            algorithm="MD5",
186                            nonce="abcdef",
187                            opaque="zyxwvu")
188 
189         # With a Bearer auth-scheme, realm is optional so you can write:
190         raise Unauthorized("Auth required.", scheme="Bearer")
191 
192         # or, if you want to specify the realm:
193         raise Unauthorized("Auth required.",
194                            scheme="Bearer",
195                            realm="Restricted Area")
196     """
197 
198     status_code = 401
199 
200     def __init__(self, message, status_code=None, scheme=None, **kwargs):
201         super().__init__(message, status_code)
202 
203         # if auth-scheme is specified, set "WWW-Authenticate" header
204         if scheme is not None:
205             values = ['{!s}="{!s}"'.format(k, v) for k, v in kwargs.items()]
206             challenge = ", ".join(values)
207 
208             self.headers = {
209                 "WWW-Authenticate": f"{scheme} {challenge}".rstrip()
210             }
211 
212 
213 class LoadFileException(SanicException):
214     pass
215 
216 
217 class InvalidSignal(SanicException):
218     pass
219 
220 
221 def abort(status_code: int, message: Optional[Union[str, bytes]] = None):
222     """
223     Raise an exception based on SanicException. Returns the HTTP response
224     message appropriate for the given status code, unless provided.
225 
226     STATUS_CODES from sanic.helpers for the given status code.
227 
228     :param status_code: The HTTP status code to return.
229     :param message: The HTTP response body. Defaults to the messages in
230     """
231     import warnings
232 
233     warnings.warn(
234         "sanic.exceptions.abort has been marked as deprecated, and will be "
235         "removed in release 21.12.\n To migrate your code, simply replace "
236         "abort(status_code, msg) with raise SanicException(msg, status_code), "
237         "or even better, raise an appropriate SanicException subclass."
238     )
239 
240     raise SanicException(message=message, status_code=status_code)
241
```
--- 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/sanic/exceptions.py b/sanic/exceptions.py
--- a/sanic/exceptions.py
+++ b/sanic/exceptions.py
@@ -31,6 +31,7 @@
     """
 
     status_code = 404
+    quiet = True
 
 
 class InvalidUsage(SanicException):
@@ -39,6 +40,7 @@
     """
 
     status_code = 400
+    quiet = True
 
 
 class MethodNotSupported(SanicException):
@@ -47,6 +49,7 @@
     """
 
     status_code = 405
+    quiet = True
 
     def __init__(self, message, method, allowed_methods):
         super().__init__(message)
@@ -70,6 +73,7 @@
     """
 
     status_code = 503
+    quiet = True
 
 
 class URLBuildError(ServerError):
@@ -101,6 +105,7 @@
     """
 
     status_code = 408
+    quiet = True
 
 
 class PayloadTooLarge(SanicException):
@@ -109,6 +114,7 @@
     """
 
     status_code = 413
+    quiet = True
 
 
 class HeaderNotFound(InvalidUsage):
@@ -117,6 +123,7 @@
     """
 
     status_code = 400
+    quiet = True
 
 
 class ContentRangeError(SanicException):
@@ -125,6 +132,7 @@
     """
 
     status_code = 416
+    quiet = True
 
     def __init__(self, message, content_range):
         super().__init__(message)
@@ -137,6 +145,7 @@
     """
 
     status_code = 417
+    quiet = True
 
 
 class Forbidden(SanicException):
@@ -145,6 +154,7 @@
     """
 
     status_code = 403
+    quiet = True
 
 
 class InvalidRangeType(ContentRangeError):
@@ -153,6 +163,7 @@
     """
 
     status_code = 416
+    quiet = True
 
 
 class PyFileError(Exception):
@@ -196,6 +207,7 @@
     """
 
     status_code = 401
+    quiet = True
 
     def __init__(self, message, status_code=None, scheme=None, **kwargs):
         super().__init__(message, status_code)

{"golden_diff": "diff --git a/sanic/exceptions.py b/sanic/exceptions.py\n--- a/sanic/exceptions.py\n+++ b/sanic/exceptions.py\n@@ -31,6 +31,7 @@\n     \"\"\"\n \n     status_code = 404\n+    quiet = True\n \n \n class InvalidUsage(SanicException):\n@@ -39,6 +40,7 @@\n     \"\"\"\n \n     status_code = 400\n+    quiet = True\n \n \n class MethodNotSupported(SanicException):\n@@ -47,6 +49,7 @@\n     \"\"\"\n \n     status_code = 405\n+    quiet = True\n \n     def __init__(self, message, method, allowed_methods):\n         super().__init__(message)\n@@ -70,6 +73,7 @@\n     \"\"\"\n \n     status_code = 503\n+    quiet = True\n \n \n class URLBuildError(ServerError):\n@@ -101,6 +105,7 @@\n     \"\"\"\n \n     status_code = 408\n+    quiet = True\n \n \n class PayloadTooLarge(SanicException):\n@@ -109,6 +114,7 @@\n     \"\"\"\n \n     status_code = 413\n+    quiet = True\n \n \n class HeaderNotFound(InvalidUsage):\n@@ -117,6 +123,7 @@\n     \"\"\"\n \n     status_code = 400\n+    quiet = True\n \n \n class ContentRangeError(SanicException):\n@@ -125,6 +132,7 @@\n     \"\"\"\n \n     status_code = 416\n+    quiet = True\n \n     def __init__(self, message, content_range):\n         super().__init__(message)\n@@ -137,6 +145,7 @@\n     \"\"\"\n \n     status_code = 417\n+    quiet = True\n \n \n class Forbidden(SanicException):\n@@ -145,6 +154,7 @@\n     \"\"\"\n \n     status_code = 403\n+    quiet = True\n \n \n class InvalidRangeType(ContentRangeError):\n@@ -153,6 +163,7 @@\n     \"\"\"\n \n     status_code = 416\n+    quiet = True\n \n \n class PyFileError(Exception):\n@@ -196,6 +207,7 @@\n     \"\"\"\n \n     status_code = 401\n+    quiet = True\n \n     def __init__(self, message, status_code=None, scheme=None, **kwargs):\n         super().__init__(message, status_code)\n", "issue": "asyncio.exceptions.CancelledError On Windows OS\nThe following exception raised when running the hello world example on Windows with Microsoft store version of Python 3.9.\r\n\r\nWSL2 environment does not reproduce the issue.\r\n\r\n```\r\nfrom sanic import Sanic\r\nfrom sanic.response import json\r\n\r\napp = Sanic(\"My Hello, world app\")\r\n\r\n@app.route('/')\r\nasync def test(request):\r\n    return json({'hello': 'world'})\r\n\r\nif __name__ == '__main__':\r\n    app.run()\r\n```\r\n\r\n```\r\n[2021-06-30 23:00:05 -0700] [12184] [INFO] Goin' Fast @ http://127.0.0.1:8000\r\n[2021-06-30 23:00:06 -0700] [12184] [INFO] Starting worker [12184]\r\n[2021-06-30 23:00:11 -0700] - (sanic.access)[INFO][127.0.0.1:53159]: GET http://127.0.0.1:8000/  200 17\r\n[2021-06-30 23:01:11 -0700] [12184] [ERROR] Exception occurred while handling uri: 'http:///*'\r\nTraceback (most recent call last):\r\n  File \"C:\\Users\\zhiwe\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python39\\site-packages\\sanic\\http.py\", line 126, in http1\r\n    await self.http1_request_header()\r\n  File \"C:\\Users\\zhiwe\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python39\\site-packages\\sanic\\http.py\", line 188, in http1_request_header      \r\n    await self._receive_more()\r\n  File \"C:\\Users\\zhiwe\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python39\\site-packages\\sanic\\server.py\", line 222, in receive_more\r\n    await self._data_received.wait()\r\n  File \"C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64__qbz5n2kfra8p0\\lib\\asyncio\\locks.py\", line 226, in wait\r\n    await fut\r\nasyncio.exceptions.CancelledError\r\n[2021-06-30 23:01:11 -0700] - (sanic.access)[INFO][UNKNOWN]: NONE http:///*  408 664\r\n```\n", "before_files": [{"content": "from typing import Optional, Union\n\nfrom sanic.helpers import STATUS_CODES\n\n\nclass SanicException(Exception):\n    def __init__(\n        self,\n        message: Optional[Union[str, bytes]] = None,\n        status_code: Optional[int] = None,\n        quiet: Optional[bool] = None,\n    ) -> None:\n\n        if message is None and status_code is not None:\n            msg: bytes = STATUS_CODES.get(status_code, b\"\")\n            message = msg.decode(\"utf8\")\n\n        super().__init__(message)\n\n        if status_code is not None:\n            self.status_code = status_code\n\n        # quiet=None/False/True with None meaning choose by status\n        if quiet or quiet is None and status_code not in (None, 500):\n            self.quiet = True\n\n\nclass NotFound(SanicException):\n    \"\"\"\n    **Status**: 404 Not Found\n    \"\"\"\n\n    status_code = 404\n\n\nclass InvalidUsage(SanicException):\n    \"\"\"\n    **Status**: 400 Bad Request\n    \"\"\"\n\n    status_code = 400\n\n\nclass MethodNotSupported(SanicException):\n    \"\"\"\n    **Status**: 405 Method Not Allowed\n    \"\"\"\n\n    status_code = 405\n\n    def __init__(self, message, method, allowed_methods):\n        super().__init__(message)\n        self.headers = {\"Allow\": \", \".join(allowed_methods)}\n\n\nclass ServerError(SanicException):\n    \"\"\"\n    **Status**: 500 Internal Server Error\n    \"\"\"\n\n    status_code = 500\n\n\nclass ServiceUnavailable(SanicException):\n    \"\"\"\n    **Status**: 503 Service Unavailable\n\n    The server is currently unavailable (because it is overloaded or\n    down for maintenance). Generally, this is a temporary state.\n    \"\"\"\n\n    status_code = 503\n\n\nclass URLBuildError(ServerError):\n    \"\"\"\n    **Status**: 500 Internal Server Error\n    \"\"\"\n\n    status_code = 500\n\n\nclass FileNotFound(NotFound):\n    \"\"\"\n    **Status**: 404 Not Found\n    \"\"\"\n\n    def __init__(self, message, path, relative_url):\n        super().__init__(message)\n        self.path = path\n        self.relative_url = relative_url\n\n\nclass RequestTimeout(SanicException):\n    \"\"\"The Web server (running the Web site) thinks that there has been too\n    long an interval of time between 1) the establishment of an IP\n    connection (socket) between the client and the server and\n    2) the receipt of any data on that socket, so the server has dropped\n    the connection. The socket connection has actually been lost - the Web\n    server has 'timed out' on that particular socket connection.\n    \"\"\"\n\n    status_code = 408\n\n\nclass PayloadTooLarge(SanicException):\n    \"\"\"\n    **Status**: 413 Payload Too Large\n    \"\"\"\n\n    status_code = 413\n\n\nclass HeaderNotFound(InvalidUsage):\n    \"\"\"\n    **Status**: 400 Bad Request\n    \"\"\"\n\n    status_code = 400\n\n\nclass ContentRangeError(SanicException):\n    \"\"\"\n    **Status**: 416 Range Not Satisfiable\n    \"\"\"\n\n    status_code = 416\n\n    def __init__(self, message, content_range):\n        super().__init__(message)\n        self.headers = {\"Content-Range\": f\"bytes */{content_range.total}\"}\n\n\nclass HeaderExpectationFailed(SanicException):\n    \"\"\"\n    **Status**: 417 Expectation Failed\n    \"\"\"\n\n    status_code = 417\n\n\nclass Forbidden(SanicException):\n    \"\"\"\n    **Status**: 403 Forbidden\n    \"\"\"\n\n    status_code = 403\n\n\nclass InvalidRangeType(ContentRangeError):\n    \"\"\"\n    **Status**: 416 Range Not Satisfiable\n    \"\"\"\n\n    status_code = 416\n\n\nclass PyFileError(Exception):\n    def __init__(self, file):\n        super().__init__(\"could not execute config file %s\", file)\n\n\nclass Unauthorized(SanicException):\n    \"\"\"\n    **Status**: 401 Unauthorized\n\n    :param message: Message describing the exception.\n    :param status_code: HTTP Status code.\n    :param scheme: Name of the authentication scheme to be used.\n\n    When present, kwargs is used to complete the WWW-Authentication header.\n\n    Examples::\n\n        # With a Basic auth-scheme, realm MUST be present:\n        raise Unauthorized(\"Auth required.\",\n                           scheme=\"Basic\",\n                           realm=\"Restricted Area\")\n\n        # With a Digest auth-scheme, things are a bit more complicated:\n        raise Unauthorized(\"Auth required.\",\n                           scheme=\"Digest\",\n                           realm=\"Restricted Area\",\n                           qop=\"auth, auth-int\",\n                           algorithm=\"MD5\",\n                           nonce=\"abcdef\",\n                           opaque=\"zyxwvu\")\n\n        # With a Bearer auth-scheme, realm is optional so you can write:\n        raise Unauthorized(\"Auth required.\", scheme=\"Bearer\")\n\n        # or, if you want to specify the realm:\n        raise Unauthorized(\"Auth required.\",\n                           scheme=\"Bearer\",\n                           realm=\"Restricted Area\")\n    \"\"\"\n\n    status_code = 401\n\n    def __init__(self, message, status_code=None, scheme=None, **kwargs):\n        super().__init__(message, status_code)\n\n        # if auth-scheme is specified, set \"WWW-Authenticate\" header\n        if scheme is not None:\n            values = ['{!s}=\"{!s}\"'.format(k, v) for k, v in kwargs.items()]\n            challenge = \", \".join(values)\n\n            self.headers = {\n                \"WWW-Authenticate\": f\"{scheme} {challenge}\".rstrip()\n            }\n\n\nclass LoadFileException(SanicException):\n    pass\n\n\nclass InvalidSignal(SanicException):\n    pass\n\n\ndef abort(status_code: int, message: Optional[Union[str, bytes]] = None):\n    \"\"\"\n    Raise an exception based on SanicException. Returns the HTTP response\n    message appropriate for the given status code, unless provided.\n\n    STATUS_CODES from sanic.helpers for the given status code.\n\n    :param status_code: The HTTP status code to return.\n    :param message: The HTTP response body. Defaults to the messages in\n    \"\"\"\n    import warnings\n\n    warnings.warn(\n        \"sanic.exceptions.abort has been marked as deprecated, and will be \"\n        \"removed in release 21.12.\\n To migrate your code, simply replace \"\n        \"abort(status_code, msg) with raise SanicException(msg, status_code), \"\n        \"or even better, raise an appropriate SanicException subclass.\"\n    )\n\n    raise SanicException(message=message, status_code=status_code)\n", "path": "sanic/exceptions.py"}], "after_files": [{"content": "from typing import Optional, Union\n\nfrom sanic.helpers import STATUS_CODES\n\n\nclass SanicException(Exception):\n    def __init__(\n        self,\n        message: Optional[Union[str, bytes]] = None,\n        status_code: Optional[int] = None,\n        quiet: Optional[bool] = None,\n    ) -> None:\n\n        if message is None and status_code is not None:\n            msg: bytes = STATUS_CODES.get(status_code, b\"\")\n            message = msg.decode(\"utf8\")\n\n        super().__init__(message)\n\n        if status_code is not None:\n            self.status_code = status_code\n\n        # quiet=None/False/True with None meaning choose by status\n        if quiet or quiet is None and status_code not in (None, 500):\n            self.quiet = True\n\n\nclass NotFound(SanicException):\n    \"\"\"\n    **Status**: 404 Not Found\n    \"\"\"\n\n    status_code = 404\n    quiet = True\n\n\nclass InvalidUsage(SanicException):\n    \"\"\"\n    **Status**: 400 Bad Request\n    \"\"\"\n\n    status_code = 400\n    quiet = True\n\n\nclass MethodNotSupported(SanicException):\n    \"\"\"\n    **Status**: 405 Method Not Allowed\n    \"\"\"\n\n    status_code = 405\n    quiet = True\n\n    def __init__(self, message, method, allowed_methods):\n        super().__init__(message)\n        self.headers = {\"Allow\": \", \".join(allowed_methods)}\n\n\nclass ServerError(SanicException):\n    \"\"\"\n    **Status**: 500 Internal Server Error\n    \"\"\"\n\n    status_code = 500\n\n\nclass ServiceUnavailable(SanicException):\n    \"\"\"\n    **Status**: 503 Service Unavailable\n\n    The server is currently unavailable (because it is overloaded or\n    down for maintenance). Generally, this is a temporary state.\n    \"\"\"\n\n    status_code = 503\n    quiet = True\n\n\nclass URLBuildError(ServerError):\n    \"\"\"\n    **Status**: 500 Internal Server Error\n    \"\"\"\n\n    status_code = 500\n\n\nclass FileNotFound(NotFound):\n    \"\"\"\n    **Status**: 404 Not Found\n    \"\"\"\n\n    def __init__(self, message, path, relative_url):\n        super().__init__(message)\n        self.path = path\n        self.relative_url = relative_url\n\n\nclass RequestTimeout(SanicException):\n    \"\"\"The Web server (running the Web site) thinks that there has been too\n    long an interval of time between 1) the establishment of an IP\n    connection (socket) between the client and the server and\n    2) the receipt of any data on that socket, so the server has dropped\n    the connection. The socket connection has actually been lost - the Web\n    server has 'timed out' on that particular socket connection.\n    \"\"\"\n\n    status_code = 408\n    quiet = True\n\n\nclass PayloadTooLarge(SanicException):\n    \"\"\"\n    **Status**: 413 Payload Too Large\n    \"\"\"\n\n    status_code = 413\n    quiet = True\n\n\nclass HeaderNotFound(InvalidUsage):\n    \"\"\"\n    **Status**: 400 Bad Request\n    \"\"\"\n\n    status_code = 400\n    quiet = True\n\n\nclass ContentRangeError(SanicException):\n    \"\"\"\n    **Status**: 416 Range Not Satisfiable\n    \"\"\"\n\n    status_code = 416\n    quiet = True\n\n    def __init__(self, message, content_range):\n        super().__init__(message)\n        self.headers = {\"Content-Range\": f\"bytes */{content_range.total}\"}\n\n\nclass HeaderExpectationFailed(SanicException):\n    \"\"\"\n    **Status**: 417 Expectation Failed\n    \"\"\"\n\n    status_code = 417\n    quiet = True\n\n\nclass Forbidden(SanicException):\n    \"\"\"\n    **Status**: 403 Forbidden\n    \"\"\"\n\n    status_code = 403\n    quiet = True\n\n\nclass InvalidRangeType(ContentRangeError):\n    \"\"\"\n    **Status**: 416 Range Not Satisfiable\n    \"\"\"\n\n    status_code = 416\n    quiet = True\n\n\nclass PyFileError(Exception):\n    def __init__(self, file):\n        super().__init__(\"could not execute config file %s\", file)\n\n\nclass Unauthorized(SanicException):\n    \"\"\"\n    **Status**: 401 Unauthorized\n\n    :param message: Message describing the exception.\n    :param status_code: HTTP Status code.\n    :param scheme: Name of the authentication scheme to be used.\n\n    When present, kwargs is used to complete the WWW-Authentication header.\n\n    Examples::\n\n        # With a Basic auth-scheme, realm MUST be present:\n        raise Unauthorized(\"Auth required.\",\n                           scheme=\"Basic\",\n                           realm=\"Restricted Area\")\n\n        # With a Digest auth-scheme, things are a bit more complicated:\n        raise Unauthorized(\"Auth required.\",\n                           scheme=\"Digest\",\n                           realm=\"Restricted Area\",\n                           qop=\"auth, auth-int\",\n                           algorithm=\"MD5\",\n                           nonce=\"abcdef\",\n                           opaque=\"zyxwvu\")\n\n        # With a Bearer auth-scheme, realm is optional so you can write:\n        raise Unauthorized(\"Auth required.\", scheme=\"Bearer\")\n\n        # or, if you want to specify the realm:\n        raise Unauthorized(\"Auth required.\",\n                           scheme=\"Bearer\",\n                           realm=\"Restricted Area\")\n    \"\"\"\n\n    status_code = 401\n    quiet = True\n\n    def __init__(self, message, status_code=None, scheme=None, **kwargs):\n        super().__init__(message, status_code)\n\n        # if auth-scheme is specified, set \"WWW-Authenticate\" header\n        if scheme is not None:\n            values = ['{!s}=\"{!s}\"'.format(k, v) for k, v in kwargs.items()]\n            challenge = \", \".join(values)\n\n            self.headers = {\n                \"WWW-Authenticate\": f\"{scheme} {challenge}\".rstrip()\n            }\n\n\nclass LoadFileException(SanicException):\n    pass\n\n\nclass InvalidSignal(SanicException):\n    pass\n\n\ndef abort(status_code: int, message: Optional[Union[str, bytes]] = None):\n    \"\"\"\n    Raise an exception based on SanicException. Returns the HTTP response\n    message appropriate for the given status code, unless provided.\n\n    STATUS_CODES from sanic.helpers for the given status code.\n\n    :param status_code: The HTTP status code to return.\n    :param message: The HTTP response body. Defaults to the messages in\n    \"\"\"\n    import warnings\n\n    warnings.warn(\n        \"sanic.exceptions.abort has been marked as deprecated, and will be \"\n        \"removed in release 21.12.\\n To migrate your code, simply replace \"\n        \"abort(status_code, msg) with raise SanicException(msg, status_code), \"\n        \"or even better, raise an appropriate SanicException subclass.\"\n    )\n\n    raise SanicException(message=message, status_code=status_code)\n", "path": "sanic/exceptions.py"}]}