Browse files

raising an exception if the device cannot be found

  • Loading branch information...
1 parent 902517f commit e85e0ca104965d2cfb2caa0675d60efb0030b7e6 @tenderlove committed Aug 19, 2009
Showing with 5 additions and 0 deletions.
  1. +2 −0 Rakefile
  2. +3 −0 ext/nfc/nfc_device.c
View
2 Rakefile
@@ -5,6 +5,8 @@ require 'hoe'
gem 'rake-compiler', '>= 0.4.1'
require "rake/extensiontask"
+Hoe.plugin :debugging
+
HOE = Hoe.spec('nfc') do
developer('Aaron Patterson', 'aaronp@rubyforge.org')
self.readme_file = 'README.rdoc'
View
3 ext/nfc/nfc_device.c
@@ -9,6 +9,9 @@
static VALUE connect(VALUE klass)
{
dev_info * dev = nfc_connect();
+ if(!dev)
+ rb_raise(rb_eRuntimeError, "could not find NFC device");
+
if(!nfc_initiator_init(dev))
rb_raise(rb_eRuntimeError, "oh snap, could not init");

0 comments on commit e85e0ca

Please sign in to comment.