Skip to content

Commit

Permalink
Document the error handling fallback.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed May 7, 2024
1 parent 6791ed5 commit f6566dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion core/src/toga/icons.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ def __init__(
path, or a path relative to the module that defines your Toga application
class. This base filename should *not* contain an extension. If an extension
is specified, it will be ignored. If the icon cannot be found, the default
icon will be :attr:`~toga.Icon.DEFAULT_ICON`.
icon will be :attr:`~toga.Icon.DEFAULT_ICON`. If an icon file is found, but
it cannot be loaded (due to a file format or permission error), an exception
will be raised.
:param system: **For internal use only**
"""
self.factory = get_platform_factory()
Expand Down
8 changes: 5 additions & 3 deletions docs/reference/api/resources/icons.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ icon variants that are not available from the highest resolution provided (e.g.,
128px variant can be found, one will be created by scaling the highest resolution
variant that *is* available).

An icon is **guaranteed** to have an implementation, regardless of the path
specified. If you specify a path and no matching icon can be found, Toga will
output a warning to the console, and return :attr:`~toga.Icon.DEFAULT_ICON`.
An icon is **guaranteed** to have an implementation, regardless of the path specified.
If you specify a path and no matching icon can be found, Toga will output a warning to
the console, and return :attr:`~toga.Icon.DEFAULT_ICON`. The only exception to this is
if an icon file is *found*, but it cannot be loaded (e.g., due to a file format or
permission error). In this case, an error will be raised.

Reference
---------
Expand Down

0 comments on commit f6566dd

Please sign in to comment.