New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return Exception message bodies as an Array #518

Closed
guns opened this Issue Apr 21, 2012 · 1 comment

Comments

Projects
None yet
2 participants
@guns
Copy link
Contributor

guns commented Apr 21, 2012

Encountered an instance where YARD returns a response body as a String.

Trivial patch follows inline.

From d761f4ab34167947e3e66bda17c856981d078cf9 Mon Sep 17 00:00:00 2001
From: guns 
Date: Sat, 21 Apr 2012 18:31:15 -0500
Subject: [PATCH] Return Exception message bodies as an Array

Rack + Ruby that lacks String#each (e.g. 1.9.3) blows up when response
body returns a String.

---
 lib/yard/server/rack_adapter.rb |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/yard/server/rack_adapter.rb b/lib/yard/server/rack_adapter.rb
index 596332f..cf69286 100644
--- a/lib/yard/server/rack_adapter.rb
+++ b/lib/yard/server/rack_adapter.rb
@@ -52,7 +52,7 @@ module YARD
       rescue StandardError => ex
         log.backtrace(ex)
         [500, {'Content-Type' => 'text/plain'}, 
-          ex.message + "\n" + ex.backtrace.join("\n")]
+          [ex.message + "\n" + ex.backtrace.join("\n")]]
       end
 
       # Starts the +Rack::Server+. This method will pass control to the server and
-- 
1.7.10.rc2.19.gfae9d

@lsegal

This comment has been minimized.

Copy link
Owner

lsegal commented Apr 26, 2012

Fixed in a644306. Thanks!

For future reference, forking and submitting a proper pull request is much easier to deal with than git email patches that aren't actually emails :) At worst, a standard git diff would have been better.

@lsegal lsegal closed this Apr 26, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment