Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #7962 (closed enhancement: fixed)

Opened 1 year ago

Last modified 2 months ago

[PATCH] Enhancement to cgi_methods#type_conflict! to display invalid value and to correct spelling error

Reported by: spicycode Assigned to: core
Priority: normal Milestone: 2.x
Component: ActionPack Version: edge
Severity: normal Keywords: verified
Cc:

Description

We ran into a type_conflict! error recently on a project and noticed the current error message is completely un-helpful. This error is raised before the normal GET/POST line in the log, so you can never see what the invalid bits were.

This patch makes type_conflict! display the invalid value and fixes a minor spelling error.

Attachments

display_unparseable_value_and_correct_spelling_error_on_cgi_type_conflict.diff (0.7 kB) - added by spicycode on 04/01/07 22:38:23.
more_informative_type_error.diff (0.9 kB) - added by matt on 03/07/08 00:19:55.
same patch as the original but now applying to the proper file and doing an inspect on the value.

Change History

04/01/07 22:38:23 changed by spicycode

  • attachment display_unparseable_value_and_correct_spelling_error_on_cgi_type_conflict.diff added.

04/01/07 23:10:57 changed by spicycode

Old Message

Conflicting types for parameter containers. Expected an instance of Hash, but found an instance of String. This can be caused by passing Array and Hash based paramters qs[]=value&qs[key]=value.

New Message

Conflicting types for parameter containers. Expected an instance of Hash, but found an instance of String. This can be caused by passing Array and Hash based parameters qs[]=value&qs[key]=value. The parameters received were <your parameters here>.

10/24/07 18:54:49 changed by jamesh

+1. Kinda handy when you run into this obscure problem.

12/04/07 01:21:26 changed by swindsor

+1 more. Can anyone integrate this patch in? This bites me all the time and there is no way of figuring out what your parameters where that caused the exception (since the parameters have yet to be logged at this point).

03/07/08 00:18:39 changed by matt

+ 1 for the idea, debugging a type conflict is a mess. however the patch doesn't apply properly against Edge.

03/07/08 00:19:55 changed by matt

  • attachment more_informative_type_error.diff added.

same patch as the original but now applying to the proper file and doing an inspect on the value.

03/07/08 00:20:16 changed by matt

  • keywords set to verified.

03/07/08 01:23:15 changed by rick

  • status changed from new to closed.
  • resolution set to fixed.

(In [8986]) Better error message for type conflicts when parsing params. Closes #7962 [spicycode, matt]