error_text(func) that calls the zero-argument func() and returns the string 'ok' on success, or f'failed: {err}' when it raises — where err is the caught exception converted to its message text via str(). Practice binding the exception with as and using its printable form.error_text(lambda: int('xyz'))"failed: invalid literal for int() with base 10: 'xyz'"
str(err) yields the human-readable message.
except Exception as err binds the object.
f-strings call str() on the exception automatically.