diff --git a/_modules/rundeck.py b/_modules/rundeck.py
index 07f04b6..11f678f 100644
--- a/_modules/rundeck.py
+++ b/_modules/rundeck.py
@@ -19,15 +19,13 @@
     elif status_code == 404:
         return None
     raise salt.exceptions.SaltInvocationError(
-        "Could not retrieve information about project {} from Rundeck {}: {}"
-        .format(name, make_url.base_url, status_code))
+        "Could not retrieve information about project {} from Rundeck {}: "
+        "{}/{}".format(name, make_url.base_url, status_code, resp.text))
 
 
 def create_project(name, params):
     session, make_url = get_session()
     config = create_project_config(name, params)
-    LOG.debug("create_project: %s", name)
-    LOG.warning("create_project.config: %s/%s", name, config)
     resp = session.post(
         make_url("/api/18/projects"),
         json={
@@ -38,7 +36,6 @@
     )
     if resp.status_code == 201:
         return resp.json()
-    LOG.debug("create_project: %s", name)
 
 
 def update_project_config(name, project, config):
@@ -50,7 +47,6 @@
     )
     if resp.status_code == 201:
         return resp.json()
-    LOG.debug("update_project: %s", name)
 
 
 def delete_project(name):
@@ -59,8 +55,8 @@
     status_code = resp.status_code
     if status_code != 204:
         raise salt.exceptions.SaltInvocationError(
-            "Could not remove project {} from Rundeck {}: {}"
-            .format(name, make_url.base_url, status_code))
+            "Could not remove project {} from Rundeck {}: {}/{}"
+            .format(name, make_url.base_url, status_code, resp.text))
 
 
 # SCM
@@ -74,8 +70,8 @@
     elif resp.status_code == 404:
         return True, None
     return False, (
-        "Could not get config for the {} plugin of the {} project"
-        .format(integration, project_name))
+        "Could not get config for the {} plugin of the {} project: {}"
+        .format(integration, project_name, resp.text))
 
 
 def get_plugin_status(project_name, integration):
@@ -83,8 +79,12 @@
         for plugin in plugins:
             if plugin['type'] == plugin_type:
                 return plugin
+        LOG.debug(
+            "Could not find the %s integration among available plugins of "
+            "the %s projects: %s", integration, project_name, plugins)
         raise salt.exceptions.SaltInvocationError(
-            "Could not find status for the {}/{} plugin of the {} project"
+            "Could not find status for the {}/{} plugin of the {} project, "
+            "this integration is not available in your deployment."
             .format(integration, plugin_type, project_name))
 
     session, make_url = get_session()
@@ -95,8 +95,8 @@
         status = get_plugin(resp.json()['plugins'], plugin_type)
         return True, status
     return False, (
-        "Could not get status for the {} plugin of the {} project"
-        .format(integration, project_name))
+        "Could not get status for the {} plugin of the {} project: {}"
+        .format(integration, project_name, resp.text))
 
 
 def get_plugin_state(project_name, integration):
@@ -106,8 +106,8 @@
     if resp.status_code == 200:
         return True, resp.json()
     return False, (
-        "Could not get state for the {} plugin of the {} project"
-        .format(integration, project_name))
+        "Could not get state for the {} plugin of the {} project: {}"
+        .format(integration, project_name, resp.text))
 
 
 def disable_plugin(project_name, integration):
@@ -119,8 +119,8 @@
         msg = resp.json()
         return True, msg['message']
     return False, (
-        "Could not disable the {} plugin for the {} project: {}"
-        .format(integration, project_name, resp.status_code))
+        "Could not disable the {} plugin for the {} project: {}/{}"
+        .format(integration, project_name, resp.status_code, resp.text))
 
 
 def enable_plugin(project_name, integration):
@@ -132,8 +132,8 @@
         msg = resp.json()
         return True, msg['message']
     return False, (
-        "Could not enable the {} plugin for the {} project: {}"
-        .format(integration, project_name, resp.status_code))
+        "Could not enable the {} plugin for the {} project: {}/{}"
+        .format(integration, project_name, resp.status_code, resp.text))
 
 
 # SCM Import
