From 08e465c12856990f8a1ab0a47d0fccb2d9572bd1 Mon Sep 17 00:00:00 2001 From: Akinori MUSHA Date: Tue, 21 May 2013 00:14:04 +0900 Subject: [PATCH] Raise ArgumentError instead of RuntimeError on bad hash length. --- ext/digest/sha3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/digest/sha3.c b/ext/digest/sha3.c index 6758d04..1a912bb 100644 --- a/ext/digest/sha3.c +++ b/ext/digest/sha3.c @@ -30,7 +30,7 @@ sha3_init(hashState *ctx, size_t bitlen) { case FAIL: rb_raise(rb_eRuntimeError, "Unknown error"); case BAD_HASHLEN: - rb_raise(rb_eRuntimeError, "Bad hash length (must be 0, 224, 256, 384 or 512)"); + rb_raise(rb_eArgError, "Bad hash length (must be 0, 224, 256, 384 or 512)"); default: rb_raise(rb_eRuntimeError, "Unknown error code"); } @@ -68,7 +68,7 @@ rb_sha3_initialize(int argc, VALUE *argv, VALUE self) { } switch (i_hashlen) { case 0: - rb_raise(rb_eRuntimeError, "Unsupported hash length"); + rb_raise(rb_eArgError, "Unsupported hash length"); case DEFAULT_DIGEST_LEN: break; default: