diff --git a/SWIG/Lib/ruby/rubyerrors.swg b/SWIG/Lib/ruby/rubyerrors.swg index fe5ce8bd0..5de459943 100644 --- a/SWIG/Lib/ruby/rubyerrors.swg +++ b/SWIG/Lib/ruby/rubyerrors.swg @@ -6,6 +6,10 @@ %insert("header") %{ +/* Define custom error for SWIG_NullReferenceError since Ruby does not have a + built-in error that seems appropriate. */ +static VALUE rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError); + SWIGINTERN VALUE SWIG_Ruby_ErrorType(int SWIG_code) { VALUE type; @@ -43,6 +47,9 @@ SWIG_Ruby_ErrorType(int SWIG_code) { case SWIG_AttributeError: type = rb_eRuntimeError; break; + case SWIG_NullReferenceError: + type = rb_eNullReferenceError; + break; case SWIG_UnknownError: type = rb_eRuntimeError; break; @@ -52,6 +59,4 @@ SWIG_Ruby_ErrorType(int SWIG_code) { return type; } -%} - - +%} \ No newline at end of file