summaryrefslogtreecommitdiff
path: root/ext/bigdecimal
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-19 17:38:18 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-19 17:38:18 +0000
commit971a57004e346d87c7f0f55d16f1abb66fe24451 (patch)
treeb9d054de8151f72ca7b74fa72a918d6716ffc2a3 /ext/bigdecimal
parentac69adf5dea3b6b0b3df34db73cc2255fb481aa0 (diff)
* ext/bigdecimal/bigdecimal.c (check_rounding_mode, BigDecimal_mode):
raise ArgumentError instead of TypeError passing invalid modes. * test/bigdecimal/test_bigdecimal.rb (test_mode, test_round): change against the above modifications. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/bigdecimal')
-rw-r--r--ext/bigdecimal/bigdecimal.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index 64eebec..a251a8e 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -311,7 +311,7 @@ check_rounding_mode(VALUE const v)
return VP_ROUND_CEIL;
if (id == id_floor)
return VP_ROUND_FLOOR;
- break;
+ rb_raise(rb_eArgError, "invalid rounding mode");
default:
break;
@@ -320,7 +320,7 @@ check_rounding_mode(VALUE const v)
Check_Type(v, T_FIXNUM);
sw = (unsigned short)FIX2UINT(v);
if (!VpIsRoundMode(sw)) {
- rb_raise(rb_eTypeError, "invalid rounding mode");
+ rb_raise(rb_eArgError, "invalid rounding mode");
}
return sw;
}
@@ -380,7 +380,7 @@ BigDecimal_mode(int argc, VALUE *argv, VALUE self)
fo = VpGetException();
if(val==Qnil) return INT2FIX(fo);
if(val!=Qfalse && val!=Qtrue) {
- rb_raise(rb_eTypeError, "second argument must be true or false");
+ rb_raise(rb_eArgError, "second argument must be true or false");
return Qnil; /* Not reached */
}
if(f&VP_EXCEPTION_INFINITY) {