Skip to content

Return Exception message bodies as an Array #518

@guns

Description

@guns

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions