Permalink
Browse files

Added a catch for OutOfMemoryErrors.

  • Loading branch information...
1 parent a481514 commit 811b3142504d41eb069aedad5c7f9e3baaaa6a0d @Raynes committed Jul 23, 2010
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/tryclojure/core.clj
View
@@ -40,7 +40,7 @@
:timeout 1000)
result (try
(loop [history history]
- (if (not (empty? history))
+ (when (not (empty? history))
(do
((sc (first history)))
(recur (next history)))))
@@ -49,6 +49,7 @@
(let [r (pr-str ((sc form) {'*out* writer}))]
[(str (.replace (escape-html writer) "\n" "<br/>") (code (str r)))
(if (has-state? form) (conj history form) history)])))
+ (catch OutOfMemoryError _ ["Out of memory error was thrown. Cleaning up all defs." nil])
(catch TimeoutException _ ["Execution Timed Out!" history])
(catch SecurityException e
[(if (.startsWith

0 comments on commit 811b314

Please sign in to comment.