Skip to content

Commit 8be8b60

Browse files
Raise exception on not-implemented @setting(setter) (#1591)
Split out from #1586 warn for setter input from setting decorator, since it will not work to put in a function directly in the decorator since the class object has not yet been created. Therefore always the setter_name schould be used and the binding of the setter methods schould take place when the class object gets created. Co-authored-by: Teemu R. <tpr@iki.fi>
1 parent db40713 commit 8be8b60

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

miio/devicestatus.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,11 @@ def decorator_setting(func):
201201
qualified_name = str(func.__qualname__)
202202

203203
if setter is None and setter_name is None:
204-
raise Exception("Either setter or setter_name needs to be defined")
204+
raise Exception("setter_name needs to be defined")
205+
if setter_name is None:
206+
raise NotImplementedError(
207+
"setter not yet implemented, use setter_name instead"
208+
)
205209

206210
common_values = {
207211
"id": qualified_name,

0 commit comments

Comments
 (0)