I made a mistake making a quick manual adjustment to a poll. The draft saved fine, but when I tried to post it, I got an “Internal Server Error.” I wasted quite a bit of time trying to figure out what was wrong. Some better feedback would have helped. I had no suspicion concerning my poll.
A server error definitely shouldn’t happen for a malformed poll! Can you post the markup you used here? (Enclose it in
[code][/code] if it decides to cause an issue here )
The reason I didn’t suspect the poll is because it renders fine in the preview area. Here’s the code (and yes, I tried to post the actual poll, but it did the same thing here):
[poll type=single results= on_vote min=1 max=4] * Regularly * Sometimes * Rarely * Never [/poll]
ArgumentError ('single' is not a valid type) /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.0/lib/active_record/enum.rb:140:in `assert_valid_value' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.0/lib/active_record/enum.rb:140:in `assert_valid_value' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/activemodel-5.2.0/lib/active_model/attribute.rb:71:in `with_value_from_user' .... /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.0/lib/active_record/persistence.rb:52:in `create!' /var/www/discourse/plugins/poll/plugin.rb:238:in `create!'
We are trying to set a value on an
enum that is not allowed and not handling the exception.
That’s a good repro, thanks!
@nbianca can you make sure we’re properly handling this exception and showing the proper error message to the user?
Added argument validation in