Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Hide full links in docs #29

Merged
merged 7 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,21 @@ Custom exceptions
-----------------

.. warning:: For any of these errors to work, you need to register the error handlers in your Flask app.
To do this, you can call :meth:`flask_utils.errors.register_error_handlers` with your Flask app as an argument.

To do this, you need to pass :attr:`register_error_handlers=True` to the :class:`~flask_utils.extension.FlaskUtils` class or to :meth:`~flask_utils.extension.FlaskUtils.init_app()`.

.. code-block:: python

from flask_utils import register_error_handlers
register_error_handlers(app)
from flask import Flask
from flask_utils import FlaskUtils

app = Flask(__name__)
utils = FlaskUtils(app, register_error_handlers=True)

# OR

utils = FlaskUtils()
utils.init_app(app, register_error_handlers=True)

.. automodule:: flask_utils.errors
:members:
Expand Down
2 changes: 2 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,5 @@

# -- Options for EPUB output
epub_show_urls = "footnote"

add_module_names = False
2 changes: 1 addition & 1 deletion flask_utils/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def validate_params(
and the values are the expected types.
:param allow_empty: Allow empty values for parameters. Defaults to False.

:raises flask_utils.errors.badrequest.BadRequestError: If the JSON body is malformed,
:raises BadRequestError: If the JSON body is malformed,
the Content-Type header is missing or incorrect, required parameters are missing,
or parameters are of the wrong type.

Expand Down
4 changes: 2 additions & 2 deletions flask_utils/errors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def _register_error_handlers(application: Flask) -> None:

.. versionchanged:: 0.5.0
Made the function private. If you want to register the custom error handlers, you need to
pass `register_error_handlers=True` to the :class:`flask_utils.extension.FlaskUtils` class
or to :meth:`flask_utils.extension.FlaskUtils.init_app`
pass `register_error_handlers=True` to the :class:`~flask_utils.extension.FlaskUtils` class
or to :meth:`~flask_utils.extension.FlaskUtils.init_app`

.. code-block:: python

Expand Down
Loading