This project is archived and is in readonly mode.
Console/log output for malformed XML requests is not very helpful
Reported by Chris Bielinski | April 11th, 2009 @ 04:06 AM | in 2.3.4
Hey guys,
First time patcher here, so go easy on me. I'm writing a REST service in Rails and a client in Flex. I knew my Flex app was sending malformed data but I had no way of inspecting it. The Rails log output really wasn't very helpful:
/!\ FAILSAFE /!\ Fri Apr 10 19:44:12 -0700 2009
Status: 500 Internal Server Error
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.name
So my patch simply echo's the actual raw request and provides much more information:
It seems there was an error parsing the request.
The raw request is provided below:
some-malformed-XML-string-here
/!\ FAILSAFE /!\ Fri Apr 10 19:44:12 -0700 2009
Status: 500 Internal Server Error
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.name
My patch uses puts (is that okay?)
Comments and changes to this ticket
-
CancelProfileIsBroken August 6th, 2009 @ 01:40 PM
- Tag changed from debug, feature, patch, request, xml to bugmash, debug, feature, patch, request, xml
-
Gabe da Silveira August 9th, 2009 @ 12:21 PM
+1 on fixing this issue. I've been annoyed by this for quite some time. Using puts is not the right approach, but we ought to be able to do something about it...
-
Elad Meidar August 9th, 2009 @ 09:12 PM
+1 Verified... /!\ so annoying /!\
Patch applies and all tests pass on 2-3-stable (it's more of an output formatting thing... needs tests?)
Attached a patch for master.
-
Jeremy Kemper August 10th, 2009 @ 06:50 AM
- Assigned user set to Jeremy Kemper
- State changed from new to incomplete
- Milestone changed from 2.x to 2.3.4
Needs tests.
-
John Pignata August 11th, 2009 @ 06:04 AM
Here's my shot at it.
1) Instead of using puts, I've used the Rails.logger or $stderr in the absence of that.
2) I've added tests to the json and xml parser tests which capture $stderr and ensure that the log entry was madeLet me know your feedback.
-
Rizwan Reza August 13th, 2009 @ 07:05 AM
Verified. The patch by John applies cleanly on master. It doesn't work in 2-3-stable.
-
John Pignata August 13th, 2009 @ 02:48 PM
Thanks, Rizwan. Here's a patch that applies to 2-3-stable.
-
Elad Meidar August 13th, 2009 @ 09:54 PM
2-3-stable patch applies cleanly, tests pass. Tested manually as well.
-
Repository August 16th, 2009 @ 12:51 AM
- State changed from incomplete to committed
(from [1cf32ad35a32cc1259a5aebfb894f53610ffac8e]) Adding a call to logger from params_parser to give detailed debug information when invalid xml or json is posted
[#2481 state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
http://github.com/rails/rails/commit/1cf32ad35a32cc1259a5aebfb894f5... -
Repository August 16th, 2009 @ 12:51 AM
(from [679128da58636f3ec96e24fcb7daac24666b2dad]) Adding a call to logger from params_parser to give detailed debug information when invalid xml or json is posted
[#2481 state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
http://github.com/rails/rails/commit/679128da58636f3ec96e24fcb7daac...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 2481 Console/log output for malformed XML requests is not very helpful [#2481 state:committed]
- 2481 Console/log output for malformed XML requests is not very helpful [#2481 state:committed]
- 2689 POSTing Blank XML File Raises Duplicate of https://rails.lighthouseapp.com/projects/89...