From dc63613c965f52c9d040332db2688c5cd8bbe5a9 Mon Sep 17 00:00:00 2001 From: jjaffeux Date: Thu, 17 Jun 2021 15:24:35 +0200 Subject: [PATCH] =?UTF-8?q?DEV:=20improve=20error=20message=20for=20invali?= =?UTF-8?q?d=20setting=E2=80=99s=20value?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this fix we would display this exception: ``` Discourse::InvalidParameters: value ``` After this fix we will display: ``` Discourse::InvalidParameters: Invalid `x` value for `s3_region` ``` --- lib/site_settings/type_supervisor.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/site_settings/type_supervisor.rb b/lib/site_settings/type_supervisor.rb index b33030c713b..da8f4c9a809 100644 --- a/lib/site_settings/type_supervisor.rb +++ b/lib/site_settings/type_supervisor.rb @@ -204,7 +204,7 @@ class SiteSettings::TypeSupervisor def validate_value(name, type, val) if type == self.class.types[:enum] if enum_class(name) - raise Discourse::InvalidParameters.new(:value) unless enum_class(name).valid_value?(val) + raise Discourse::InvalidParameters.new("Invalid `#{val}` value for `#{name}`") unless enum_class(name).valid_value?(val) else unless (choice = @choices[name]) raise Discourse::InvalidParameters.new(name)