Procházet zdrojové kódy

Conditionally raise error

Christopher Mullins před 6 roky
rodič
revize
b10d676967
1 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. 2 2
      test/remote/lib/mqtt_client.rb

+ 2 - 2
test/remote/lib/mqtt_client.rb

@@ -70,7 +70,7 @@ class MqttClient
     end
   end
 
-  def on_message(topic, timeout = 10, &block)
+  def on_message(topic, timeout = 10, raise_error = true, &block)
     @listen_threads << Thread.new do
       begin
         Timeout.timeout(timeout) do
@@ -81,7 +81,7 @@ class MqttClient
         end
       rescue Timeout::Error => e
         puts "Timed out listening for message on: #{topic}"
-        raise e
+        raise e if raise_error
       rescue BreakListenLoopError
       end
     end