mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:04:11 +08:00
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` ```
This commit is contained in:
parent
ff6114d83f
commit
dc63613c96
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user