Skip to content

Commit 4ce77ff

Browse files
committed
Ruby - catch exceptions by const reference
1 parent c08e0d1 commit 4ce77ff

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Lib/ruby/rubycontainer.swg

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ namespace swig
628628
try {
629629
r = swig::from< const Sequence* >( swig::getslice(self, i, j) );
630630
}
631-
catch( std::out_of_range& ) {
631+
catch( const std::out_of_range& ) {
632632
}
633633
return r;
634634
}
@@ -687,9 +687,8 @@ namespace swig
687687
r = swig::from< Sequence::value_type >( *(at) );
688688
$self->erase(at);
689689
}
690-
catch (std::out_of_range&)
691-
{
692-
}
690+
catch (const std::out_of_range&) {
691+
}
693692
return r;
694693
}
695694
}
@@ -757,7 +756,7 @@ namespace swig
757756
try {
758757
r = swig::from< Sequence::value_type >( *(swig::cgetpos(self, i)) );
759758
}
760-
catch( std::out_of_range& ) {
759+
catch( const std::out_of_range& ) {
761760
}
762761
return r;
763762
}
@@ -780,7 +779,7 @@ namespace swig
780779
try {
781780
r = swig::from< const Sequence* >( swig::getslice(self, i, j) );
782781
}
783-
catch( std::out_of_range& ) {
782+
catch( const std::out_of_range& ) {
784783
}
785784
return r;
786785
}
@@ -790,7 +789,7 @@ namespace swig
790789
try {
791790
r = swig::from< Sequence::value_type >( *(swig::cgetpos(self, i)) );
792791
}
793-
catch( std::out_of_range& ) {
792+
catch( const std::out_of_range& ) {
794793
}
795794
return r;
796795
}
@@ -1017,7 +1016,7 @@ namespace swig {
10171016
} else {
10181017
return rubyseq.check() ? SWIG_OK : SWIG_ERROR;
10191018
}
1020-
} catch (std::exception& e) {
1019+
} catch (const std::exception& e) {
10211020
if (seq) {
10221021
VALUE lastErr = rb_gv_get("$!");
10231022
if (lastErr == Qnil) {
@@ -1057,7 +1056,7 @@ namespace swig {
10571056
} else {
10581057
return true;
10591058
}
1060-
} catch (std::exception& e) {
1059+
} catch (const std::exception& e) {
10611060
if (seq) {
10621061
VALUE lastErr = rb_gv_get("$!");
10631062
if (lastErr == Qnil) {

0 commit comments

Comments
 (0)