summaryrefslogtreecommitdiff
path: root/src/utils.clj
diff options
context:
space:
mode:
authorScott Ostler <scottbot9000@gmail.com>2010-06-22 14:11:08 -0400
committerScott Ostler <scottbot9000@gmail.com>2010-06-22 14:11:08 -0400
commit8955fabcc5f550eb3eb7c0a43c045e444878edff (patch)
tree2acd6f13ce5e85c93ae7142aec6763566e92ff76 /src/utils.clj
parent8bd14cf5d2acb1e3c50b6f9e9eaa3fddc3e36b71 (diff)
Fixed error message for broken chat template
Diffstat (limited to 'src/utils.clj')
-rwxr-xr-xsrc/utils.clj20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/utils.clj b/src/utils.clj
index 04b870f..fbdefda 100755
--- a/src/utils.clj
+++ b/src/utils.clj
@@ -259,16 +259,18 @@
(def template-group (new StringTemplateGroup "dumpfm" "template"))
(.setRefreshInterval template-group 3)
-; TODO: handle exception, clean-up template setting
(defn fetch-template [template session]
- (let [st (.getInstanceOf template-group template)]
- (if (session :nick)
- (do (.setAttribute st "user_email" (session :email))
- (.setAttribute st "user_nick" (session :nick))
- (if (non-empty-string? (session :avatar))
- (.setAttribute st "user_avatar" (session :avatar)))
- (.setAttribute st "isadmin" (session :is_admin))))
- st))
+ (try
+ (let [st (.getInstanceOf template-group template)]
+ (if (session :nick)
+ (doto st
+ (.setAttribute "user_email" (session :email))
+ (.setAttribute "user_nick" (session :nick))
+ (.setAttribute "user_avatar" (if (non-empty-string? (session :avatar))
+ (session :avatar) nil))
+ (.setAttribute "isadmin" (session :is_admin)))
+ st))
+ (catch Exception e nil)))
(defn fetch-template-fragment [template]
(.getInstanceOf template-group template))