Skip to content

Commit

Permalink
docs: add documentation for exceptions on rtd.io
Browse files Browse the repository at this point in the history
  • Loading branch information
DatGuy1 committed Sep 11, 2023
1 parent d3b6b08 commit ada6a7d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Contents
user/toast
user/audio
user/wrappers
user/exceptions

.. toctree::
:maxdepth: 1
Expand Down
14 changes: 14 additions & 0 deletions docs/user/exceptions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Exceptions
==========

Classes
-------

.. autosummary::
windows_toasts.exceptions.InvalidImageException
windows_toasts.exceptions.ToastNotFoundError

API
---

.. automodule:: windows_toasts.exceptions
5 changes: 5 additions & 0 deletions docs/user/wrappers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ API
---

.. automodule:: windows_toasts.wrappers
:exclude-members: ToastImage

.. autoclass:: windows_toasts.wrappers.ToastImage

.. automethod:: __init__

..
This will probably go into another file soon
Expand Down
4 changes: 2 additions & 2 deletions src/windows_toasts/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ class ToastImage:

def __init__(self, imagePath: Union[str, PathLike]):
"""
Initialise an :class:`ToastImage` class to use in certain classes
Initialise an :class:`ToastImage` class to use in certain classes.
Online images are supported only in packaged apps that have the internet capability in their manifest.
Unpackaged apps don't support http images; you must download the image to your local app data,
and reference it locally.
:param imagePath: The path to an image file
:type imagePath: Union[str, PathLike]
:raises: ValueError: If the path to an online image is supplied
:raises: InvalidImageException: If the path to an online image is supplied
"""
if isinstance(imagePath, str) and urlparse(imagePath).scheme in ("http", "https"):
raise InvalidImageException("Online images are not supported")
Expand Down

0 comments on commit ada6a7d

Please sign in to comment.