@@ -182,11 +182,25 @@ def _interpret_errors_1(
182182 # generated code is constructed, or if the introspection data from
183183 # which the auto-generated code is constructed does not match the
184184 # daemon interface. This situation is unlikely and difficult to
185- # elicit in a test.
185+ # elicit in a test. It may arise however, in the case where there
186+ # is an error producing a property and that property, even although
187+ # part of the official API, is missing from the GetManagedObjects result.
186188 if isinstance (
187189 error ,
188190 (DbusClientMissingSearchPropertiesError , DbusClientMissingPropertyError ),
189191 ): # pragma: no cover
192+ if len (errors ) > 1 :
193+ maybe_key_error = errors [1 ]
194+ if isinstance (maybe_key_error , KeyError ):
195+ return (
196+ f'Property "{ maybe_key_error .args [0 ]} " belonging to '
197+ f'interface "{ error .interface_name } " is not in this '
198+ "GetManagedObjects result. This could be due to the fact "
199+ "that stratisd omitted the property from the "
200+ "GetManagedObjects result because there was an error in "
201+ "obtaining that value."
202+ )
203+
190204 return _DBUS_INTERFACE_MSG
191205
192206 if isinstance (error , StratisCliEngineError ):
@@ -246,7 +260,7 @@ def _interpret_errors_1(
246260 return None # pragma: no cover
247261
248262
249- def _interpret_errors_2 (errors ):
263+ def _interpret_errors_2 (errors ): # pylint: disable=too-many-return-statements
250264 """
251265 Interpret the error when it is known that the first error is a
252266 DPClientInvocationError
@@ -309,6 +323,16 @@ def _interpret_errors_2(errors):
309323 f"{ next_error .get_dbus_message ()} ."
310324 )
311325
326+ if isinstance (context , DPClientGetPropertyContext ): # pragma: no cover
327+ return (
328+ f"stratisd failed to perform the operation that you "
329+ f"requested, because it could not get the D-Bus "
330+ f'property "{ context .property_name } " belonging to '
331+ f'interface "{ error .interface_name } ". '
332+ f"It returned the following error: "
333+ f"{ next_error .get_dbus_message ()} ."
334+ )
335+
312336 if next_error .get_dbus_name () == "org.freedesktop.DBus.Error.NoReply" :
313337 context = error .context
314338 if (
0 commit comments