Return feature-not-implemented for unknown iq

Stephen Paul Weber created

By default, blather treats both false and nil returns from a handler as
a signal to pass control to the next handler.  That's counter-intuitive,
so let's over-ride that and always stop after the first handler (unless
throw(:pass) is explicitly called).

Change summary

sgx-catapult.rb | 9 +++++++++
1 file changed, 9 insertions(+)

Detailed changes

sgx-catapult.rb 🔗

@@ -70,6 +70,7 @@ class SGXClient < Blather::Client
 			begin
 				v = block.call(stanza)
 				v.catch(&method(:panic)) if v.is_a?(Promise)
+				true # Do not run other handlers unless throw :pass
 			rescue Exception => e
 				panic(e)
 			end
@@ -822,6 +823,14 @@ module SGXcatapult
 		#write_to_stream s.approve!
 		#write_to_stream s.request!
 	end
+
+	iq :get? do |i|
+		write_to_stream error_msg(i.reply, i.children, 'cancel', 'feature-not-implemented')
+	end
+
+	iq :set? do |i|
+		write_to_stream error_msg(i.reply, i.children, 'cancel', 'feature-not-implemented')
+	end
 end
 
 [:INT, :TERM].each do |sig|