@@ -183,11 +183,28 @@ def _interpret_errors_1( # pylint: disable=too-many-return-statements, too-many
183183 # generated code is constructed, or if the introspection data from
184184 # which the auto-generated code is constructed does not match the
185185 # daemon interface. This situation is unlikely and difficult to
186- # elicit in a test.
186+ # elicit in a test. It may arise however, in the case where there
187+ # is an error producing a property and that property, even although
188+ # part of the official API, is missing from the GetManagedObjects result.
187189 if isinstance (
188190 error ,
189191 (DbusClientMissingSearchPropertiesError , DbusClientMissingPropertyError ),
190192 ): # pragma: no cover
193+ if len (errors ) > 1 :
194+ maybe_key_error = errors [1 ]
195+ if isinstance (maybe_key_error , KeyError ):
196+ prop_key = (
197+ maybe_key_error .args [0 ] if len (maybe_key_error .args ) > 0 else ""
198+ )
199+ return (
200+ f'Property "{ prop_key } " belonging to interface '
201+ f'"{ error .interface_name } " is not in this '
202+ "GetManagedObjects result. This could be due to the fact "
203+ "that stratisd omitted the property from the "
204+ "GetManagedObjects result because there was an error in "
205+ "obtaining that value."
206+ )
207+
191208 return _DBUS_INTERFACE_MSG
192209
193210 if isinstance (error , StratisCliEngineError ):
@@ -247,7 +264,7 @@ def _interpret_errors_1( # pylint: disable=too-many-return-statements, too-many
247264 return None # pragma: no cover
248265
249266
250- def _interpret_errors_2 (
267+ def _interpret_errors_2 ( # pylint: disable=too-many-return-statements
251268 errors : List [BaseException ],
252269) -> Optional [str ]:
253270 """
@@ -312,6 +329,16 @@ def _interpret_errors_2(
312329 f"{ next_error .get_dbus_message ()} ."
313330 )
314331
332+ if isinstance (context , DPClientGetPropertyContext ): # pragma: no cover
333+ return (
334+ f"stratisd failed to perform the operation that you "
335+ f"requested, because it could not get the D-Bus "
336+ f'property "{ context .property_name } " belonging to '
337+ f'interface "{ error .interface_name } ". '
338+ f"It returned the following error: "
339+ f"{ next_error .get_dbus_message ()} ."
340+ )
341+
315342 if next_error .get_dbus_name () == "org.freedesktop.DBus.Error.NoReply" :
316343 context = error .context
317344 if (
0 commit comments