From 16e24b6af7cd9b50af51f1c3b81214e7c50fa3dc Mon Sep 17 00:00:00 2001
From: "Bo-Chun Louis Chen(VM)" <louistw@uab.edu>
Date: Tue, 17 Mar 2020 01:53:22 +0000
Subject: [PATCH] Make error message more verbose

---
 ohpc_account_create.py | 3 ++-
 ood_account_create.py  | 3 ++-
 slurm_agent.py         | 5 +++--
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/ohpc_account_create.py b/ohpc_account_create.py
index 46d2d0c..4504702 100644
--- a/ohpc_account_create.py
+++ b/ohpc_account_create.py
@@ -20,7 +20,8 @@ def ohpc_account_create(ch, method, properties, body):
         print("[{}]: User {} has been added".format(task, username))
         success = True
     except:
-        print("Failed to create user")
+        e = sys.exc_info()[0]
+        print("[{}]: Error: {}".format(task, e))
 
     ch.basic_ack(delivery_tag=method.delivery_tag)
     msg['uid'] = getpwnam(username).pw_uid
diff --git a/ood_account_create.py b/ood_account_create.py
index 91ab36a..1ff9cc9 100644
--- a/ood_account_create.py
+++ b/ood_account_create.py
@@ -22,7 +22,8 @@ def ood_account_create(ch, method, properties, body):
         print("[{}]: User {} has been added".format(task, username))
         success = True
     except:
-        print("Failed to create user")
+        e = sys.exc_info()[0]
+        print("[{}]: Error: {}".format(task, e))
 
     ch.basic_ack(delivery_tag=method.delivery_tag)
 
diff --git a/slurm_agent.py b/slurm_agent.py
index 26aabe2..221dc8d 100755
--- a/slurm_agent.py
+++ b/slurm_agent.py
@@ -20,8 +20,9 @@ def slurm_account_create(ch, method, properties, body):
         print("SLURM account for user {} has been added".format(username))
         success = True
     except:
-        print("Failed to create user")
-    
+        e = sys.exc_info()[0]
+        print("[{}]: Error: {}".format(task, e))
+
     ch.basic_ack(delivery_tag=method.delivery_tag)
 
     # send confirm message
-- 
GitLab