lib/nutella_lib/net.rb in nutella_lib-0.4.7 vs lib/nutella_lib/net.rb in nutella_lib-0.4.8
- old
+ new
@@ -197,11 +197,11 @@
type, from, payload, _ = extract_fields_from_message mqtt_message
callback.call(payload, un_pad_channel(mqtt_channel, app_id, run_id), from) if type=='publish'
rescue JSON::ParserError
# Make sure the message is JSON, if not drop the message
return
- rescue
+ rescue ArgumentError
# Check the passed callback has the right number of arguments
STDERR.puts "The callback you passed to subscribe has the #{$!}: it needs 'payload', 'channel' and 'from'"
end
end
else
@@ -210,11 +210,11 @@
type, from, payload, _ = extract_fields_from_message message
callback.call(payload, from) if type=='publish'
rescue JSON::ParserError
# Make sure the message is JSON, if not drop the message
return
- rescue
+ rescue ArgumentError
# Check the passed callback has the right number of arguments
STDERR.puts "The callback you passed to subscribe has the #{$!}: it needs 'payload' and 'from'"
end
end
end
@@ -355,10 +355,10 @@
m = self.prepare_message_for_response( callback.call( payload, from), id )
Nutella.mqtt.publish( padded_channel, m )
rescue JSON::ParserError
# Make sure that request contains JSON, if not drop the message
return
- rescue
+ rescue ArgumentError
# Check that the passed callback has the right number of arguments
STDERR.puts "The callback you passed to subscribe has the #{$!}: it needs 'payload' and 'from'"
end
end
# Subscribe to the channel
\ No newline at end of file