diff options
author | Josef Reidinger <jreidinger@suse.cz> | 2012-02-16 13:50:19 +0100 |
---|---|---|
committer | Josef Reidinger <jreidinger@suse.cz> | 2012-02-16 13:50:19 +0100 |
commit | 8386a0715806c78cd795ce14613d5a067ac80590 (patch) | |
tree | 59f5b12a8dea7ad70f47f2986d409f8afae8a427 /swig | |
parent | 578cd3256eec513589e9463ffa1aa5cf34f042f8 (diff) | |
download | libzypp-bindings-8386a0715806c78cd795ce14613d5a067ac80590.tar.gz libzypp-bindings-8386a0715806c78cd795ce14613d5a067ac80590.tar.bz2 libzypp-bindings-8386a0715806c78cd795ce14613d5a067ac80590.zip |
predefine class for exception in ruby, so you can catch it with rescue ZYppException ( and constant is known after require )
Diffstat (limited to 'swig')
-rw-r--r-- | swig/ruby/ruby.i | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/swig/ruby/ruby.i b/swig/ruby/ruby.i index d2d3025..9d5ad5d 100644 --- a/swig/ruby/ruby.i +++ b/swig/ruby/ruby.i @@ -111,13 +111,16 @@ namespace zypp } \ } +%wrapper { + static VALUE zyppexception = rb_define_class("ZYppException", rb_eStandardError); +} + %exception { try { $action } catch (const Exception& e) { - static VALUE zyppexception = rb_define_class("ZYppException", rb_eStandardError); std::string tmp = e.historyAsString() + e.asUserString(); rb_raise(zyppexception, tmp.c_str()); } |