diff --git a/lib/rodauth/features/base.rb b/lib/rodauth/features/base.rb index ac74a8bb..15e9d98d 100644 --- a/lib/rodauth/features/base.rb +++ b/lib/rodauth/features/base.rb @@ -766,7 +766,7 @@ def hmac_secret_rotation? end def compute_raw_hmac(data) - raise ArgumentError, "hmac_secret not set" unless hmac_secret + raise ConfigurationError, "hmac_secret not set" unless hmac_secret compute_raw_hmac_with_secret(data, hmac_secret) end @@ -885,7 +885,7 @@ def use_scope_clear_session? def require_response(meth) send(meth) - raise RuntimeError, "#{meth.to_s.sub(/\A_/, '')} overridden without returning a response (should use redirect or request.halt). This is a bug in your Rodauth configuration, not a bug in Rodauth itself." + raise ConfigurationError, "#{meth.to_s.sub(/\A_/, '')} overridden without returning a response (should use redirect or request.halt)." end def set_session_value(key, value) diff --git a/lib/rodauth/features/jwt.rb b/lib/rodauth/features/jwt.rb index 3e455bd1..bc0a267b 100644 --- a/lib/rodauth/features/jwt.rb +++ b/lib/rodauth/features/jwt.rb @@ -64,7 +64,7 @@ def clear_session end def jwt_secret - raise ArgumentError, "jwt_secret not set" + raise ConfigurationError, "jwt_secret not set" end def jwt_session_hash diff --git a/lib/rodauth/features/sms_codes.rb b/lib/rodauth/features/sms_codes.rb index 894bb871..8d48a80e 100644 --- a/lib/rodauth/features/sms_codes.rb +++ b/lib/rodauth/features/sms_codes.rb @@ -514,7 +514,7 @@ def sms_new_confirm_code end def sms_send(phone, message) - raise NotImplementedError, "sms_send needs to be defined in the Rodauth configuration for SMS sending to work" + raise ConfigurationError, "sms_send needs to be defined in the Rodauth configuration for SMS sending to work" end def update_sms(values) diff --git a/spec/change_login_spec.rb b/spec/change_login_spec.rb index 6aae9a83..b4520335 100644 --- a/spec/change_login_spec.rb +++ b/spec/change_login_spec.rb @@ -250,6 +250,6 @@ visit '/change-login' fill_in 'Login', :with=>'foo3@example.com' fill_in 'Confirm Login', :with=>'foo3@example.com' - proc{click_button 'Change Login'}.must_raise RuntimeError + proc{click_button 'Change Login'}.must_raise Rodauth::ConfigurationError end end diff --git a/spec/login_spec.rb b/spec/login_spec.rb index 716326ec..ec14be51 100644 --- a/spec/login_spec.rb +++ b/spec/login_spec.rb @@ -558,7 +558,7 @@ rodauth do enable :login, :logout json_response_custom_error_status? false - jwt_secret{proc{super()}.must_raise ArgumentError; "1"} + jwt_secret{proc{super()}.must_raise Rodauth::ConfigurationError; "1"} end roda(:jwt) do |r| r.rodauth diff --git a/spec/rodauth_spec.rb b/spec/rodauth_spec.rb index 9a05b2d5..36bf3bcf 100644 --- a/spec/rodauth_spec.rb +++ b/spec/rodauth_spec.rb @@ -1367,7 +1367,7 @@ def foo rodauth.compute_hmac("secret") end - error = proc{visit "/"}.must_raise(ArgumentError) + error = proc{visit "/"}.must_raise(Rodauth::ConfigurationError) error.message.must_equal "hmac_secret not set" end diff --git a/spec/two_factor_spec.rb b/spec/two_factor_spec.rb index 020fe54e..94f16d7e 100644 --- a/spec/two_factor_spec.rb +++ b/spec/two_factor_spec.rb @@ -28,7 +28,7 @@ def reset_otp_last_use end sms_send do |phone, msg| - proc{super(phone, msg)}.must_raise NotImplementedError + proc{super(phone, msg)}.must_raise Rodauth::ConfigurationError sms_phone = phone sms_message = msg end