From 5f53a1357a23e96e061a6513b0e58d6c8b83a468 Mon Sep 17 00:00:00 2001 From: Charlie Savage Date: Mon, 9 Jan 2006 19:43:26 +0000 Subject: [PATCH] Added Ruby support for SWIG_NullReferenceError. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8324 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Lib/ruby/rubyerrors.swg | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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