ruby interface: raise an exception if we couldn't open a file
authorMatthias Kramm <kramm@quiss.org>
Thu, 7 Jan 2010 02:07:16 +0000 (18:07 -0800)
committerMatthias Kramm <kramm@quiss.org>
Thu, 7 Jan 2010 02:07:16 +0000 (18:07 -0800)
lib/ruby/gfx.c

index 661d8ef..958ce40 100644 (file)
@@ -63,6 +63,9 @@ static VALUE doc_initialize(VALUE cls, VALUE _filename)
     const char*filename = StringValuePtr(_filename);
     doc->fontlist = gfxfontlist_create();
     doc->doc = pdfdriver->open(pdfdriver, filename);
+    if(!doc->doc) {
+       rb_raise(rb_eIOError, "couldn't open %s", filename);
+    }
     return cls;
 }