summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorTom Black <[email protected]>2017-06-04 21:11:56 -0400
committerTom Black <[email protected]>2017-06-04 21:11:56 -0400
commit30c0f7ad8923ad1a90071234dcab7d4cc60268d4 (patch)
tree52a57d8e0856c40dd6f758c6b2e8121f5b3887d9 /lib
parente87ee92576e6e9a1aec39c77d38a2e14f033c31d (diff)
downloadruby2d-30c0f7ad8923ad1a90071234dcab7d4cc60268d4.tar.gz
ruby2d-30c0f7ad8923ad1a90071234dcab7d4cc60268d4.zip
Test for bad event types
Diffstat (limited to 'lib')
-rw-r--r--lib/ruby2d/window.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/ruby2d/window.rb b/lib/ruby2d/window.rb
index 9970861..377523b 100644
--- a/lib/ruby2d/window.rb
+++ b/lib/ruby2d/window.rb
@@ -123,6 +123,9 @@ module Ruby2D
end
def on(event, &proc)
+ unless @events.has_key? event
+ raise Error, "`#{event}` is not a valid event type"
+ end
event_id = new_event_key
@events[event][event_id] = proc
EventDescriptor.new(event, event_id)