Skip to content

Commit

Permalink
Merge pull request #1992 from freakboy3742/notimpl-helper
Browse files Browse the repository at this point in the history
Improve error message when a platform doesn't support a widget.
  • Loading branch information
mhsmith authored Jun 19, 2023
2 parents 7d68e74 + 9c6b4d5 commit 657e551
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions android/src/toga_android/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@ def not_implemented(feature):
"Paths",
"dialogs",
]


def __getattr__(name): # pragma: no cover
raise NotImplementedError(f"Toga's Android backend doesn't implement {name}")
1 change: 1 addition & 0 deletions changes/1992.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A more informative error message is returned when a platform backend doesn't support a widget.
4 changes: 4 additions & 0 deletions cocoa/src/toga_cocoa/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,7 @@ def not_implemented(feature):
"WebView",
"Window",
]


def __getattr__(name): # pragma: no cover
raise NotImplementedError(f"Toga's Cocoa backend doesn't implement {name}")
4 changes: 4 additions & 0 deletions gtk/src/toga_gtk/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,7 @@ def not_implemented(feature):
"WebView",
"Window",
]


def __getattr__(name): # pragma: no cover
raise NotImplementedError(f"Toga's GTK backend doesn't implement {name}")
4 changes: 4 additions & 0 deletions iOS/src/toga_iOS/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,7 @@ def not_implemented(feature):
"WebView",
"Window",
]


def __getattr__(name): # pragma: no cover
raise NotImplementedError(f"Toga's iOS backend doesn't implement {name}")
4 changes: 4 additions & 0 deletions web/src/toga_web/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,7 @@ def not_implemented(feature):
# 'WebView',
# 'Window',
]


def __getattr__(name): # pragma: no cover
raise NotImplementedError(f"Toga's Web backend doesn't implement {name}")
4 changes: 4 additions & 0 deletions winforms/src/toga_winforms/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,7 @@ def not_implemented(feature):
"WebView",
"Window",
]


def __getattr__(name): # pragma: no cover
raise NotImplementedError(f"Toga's Winforms backend doesn't implement {name}")

0 comments on commit 657e551

Please sign in to comment.