An exception that ends the request without producing an error response. When `Finish` is raised in a `RequestHandler`, the request will end (calling `RequestHandler.finish` if it hasn't already been called), but the error-handling methods (including `RequestHandler.write_error`) wil
| 2598 | |
| 2599 | |
| 2600 | class Finish(Exception): |
| 2601 | """An exception that ends the request without producing an error response. |
| 2602 | |
| 2603 | When `Finish` is raised in a `RequestHandler`, the request will |
| 2604 | end (calling `RequestHandler.finish` if it hasn't already been |
| 2605 | called), but the error-handling methods (including |
| 2606 | `RequestHandler.write_error`) will not be called. |
| 2607 | |
| 2608 | If `Finish()` was created with no arguments, the pending response |
| 2609 | will be sent as-is. If `Finish()` was given an argument, that |
| 2610 | argument will be passed to `RequestHandler.finish()`. |
| 2611 | |
| 2612 | This can be a more convenient way to implement custom error pages |
| 2613 | than overriding ``write_error`` (especially in library code):: |
| 2614 | |
| 2615 | if self.current_user is None: |
| 2616 | self.set_status(401) |
| 2617 | self.set_header('WWW-Authenticate', 'Basic realm="something"') |
| 2618 | raise Finish() |
| 2619 | |
| 2620 | .. versionchanged:: 4.3 |
| 2621 | Arguments passed to ``Finish()`` will be passed on to |
| 2622 | `RequestHandler.finish`. |
| 2623 | """ |
| 2624 | |
| 2625 | pass |
| 2626 | |
| 2627 | |
| 2628 | class MissingArgumentError(HTTPError): |