DEV: improve error message for invalid setting’s value

DEV: improve error message for invalid setting’s value

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`
diff --git a/lib/site_settings/type_supervisor.rb b/lib/site_settings/type_supervisor.rb
index b33030c..da8f4c9 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)

GitHub sha: dc63613c965f52c9d040332db2688c5cd8bbe5a9

This commit appears in #13416 which was approved by davidtaylorhq. It was merged by tgxworld.