Raise errors in EventHandler#initialize rather than returning nil.
[ruby-ecore.git] / src / ecore / rb_event_handler.c
index 81a5fdc808f2500b0ee261e7ac9351fea47626e2..12e2739b1740392de2d1a8c81f9a47e93caf7941 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: rb_event_handler.c 357 2006-02-12 15:40:30Z tilman $
+ * $Id: rb_event_handler.c 358 2006-02-12 15:42:28Z tilman $
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
@@ -83,14 +83,14 @@ static VALUE c_init (VALUE self, VALUE type)
        int t;
 
        if (!rb_block_given_p ())
-               return Qnil;
+               rb_raise (rb_eStandardError, "block missing");
 
        Data_Get_Struct (self, RbEventHandler, h);
 
        t = NUM2INT (type);
 
        if (t <= ECORE_EVENT_NONE)
-               return Qnil;
+               rb_raise (rb_eStandardError, "invalid type");
 
        rb_iv_set (self, "@type", type);