aboutsummaryrefslogtreecommitdiffstats
path: root/numeric.c
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-06 12:54:19 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-06 12:54:19 +0000
commit1886b28752208ca3bd05091fa451edb5a3df8536 (patch)
treebda1273ecb8310f6f6f42023bf9384ac507c85a5 /numeric.c
parent6db52efa714b54646a7ebb9849a4822d6f833d0f (diff)
downloadruby-1886b28752208ca3bd05091fa451edb5a3df8536.tar.gz
numeric.c: fix exception message for nil rounding
* numeric.c (rb_num_get_rounding_option): fix exception message for the case of nil rounding mode. * test_float.rb: add an assertion for the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/numeric.c b/numeric.c
index 74771cba6f..74ee5d136a 100644
--- a/numeric.c
+++ b/numeric.c
@@ -243,7 +243,10 @@ rb_num_get_rounding_option(VALUE opts)
break;
}
invalid:
- rb_raise(rb_eArgError, "invalid rounding mode: % "PRIsVALUE, rounding);
+ if (NIL_P(rounding))
+ rb_raise(rb_eArgError, "invalid rounding mode: nil");
+ else
+ rb_raise(rb_eArgError, "invalid rounding mode: % "PRIsVALUE, rounding);
}
noopt:
return RUBY_NUM_ROUND_DEFAULT;