From 58ebd113baad2159d303614ee23baa7845e53b1a Mon Sep 17 00:00:00 2001 From: John Bintz Date: Tue, 17 Apr 2012 11:54:32 -0400 Subject: [PATCH] make sure pending results respond to failures --- lib/flowerbox/result/pending.rb | 2 ++ lib/flowerbox/server.rb | 16 +++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/flowerbox/result/pending.rb b/lib/flowerbox/result/pending.rb index ab34f68..5f182a7 100644 --- a/lib/flowerbox/result/pending.rb +++ b/lib/flowerbox/result/pending.rb @@ -7,6 +7,8 @@ module Flowerbox::Result def failure? false end + + def failures; [] ; end end end diff --git a/lib/flowerbox/server.rb b/lib/flowerbox/server.rb index 761bd99..ff4f6b4 100644 --- a/lib/flowerbox/server.rb +++ b/lib/flowerbox/server.rb @@ -47,12 +47,18 @@ module Flowerbox ws.onmessage { |message| command, data = JSON.parse(message) - output = runner.send(command, [ data ].flatten) + begin + output = runner.send(command, [ data ].flatten) - if command == 'load' - ws.send(output) - else - ws.send("ok") + if command == 'load' + ws.send(output) + else + ws.send("ok") + end + rescue => e + $stderr.puts e.message + + exit 1 end } end