[ARVADOS] updated: 5abf8f77dd45d4895bd18bd505b9b0f2370c5841

git at public.curoverse.com git at public.curoverse.com
Mon Jun 30 14:31:45 EDT 2014


Summary of changes:
 .../app/controllers/application_controller.rb       |  5 ++++-
 apps/workbench/app/views/application/404.html.erb   | 17 +++++++++++++----
 apps/workbench/test/integration/errors_test.rb      | 21 +++++++++++++++++++++
 3 files changed, 38 insertions(+), 5 deletions(-)

       via  5abf8f77dd45d4895bd18bd505b9b0f2370c5841 (commit)
       via  8e4991b586e32c66cca8e608f066dc1575eda184 (commit)
      from  1947a70aa27442e70c2d8f20fd14b6d73f973e2b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 5abf8f77dd45d4895bd18bd505b9b0f2370c5841
Author: Brett Smith <brett at curoverse.com>
Date:   Mon Jun 30 14:31:40 2014 -0400

    2891: Workbench details the requested item on its 404 page.

diff --git a/apps/workbench/app/views/application/404.html.erb b/apps/workbench/app/views/application/404.html.erb
index c1f48bd..40d73b9 100644
--- a/apps/workbench/app/views/application/404.html.erb
+++ b/apps/workbench/app/views/application/404.html.erb
@@ -1,11 +1,20 @@
+<%
+   if (controller.andand.action_name == 'show') and params[:uuid]
+     class_name = controller.model_class.to_s.underscore.humanize(capitalize: false)
+     req_item = safe_join([class_name, " with UUID ",
+                           raw("<code>"), params[:uuid], raw("</code>")], "")
+   else
+     req_item = "page you requested"
+   end
+%>
+
 <h2>Not Found</h2>
 
-<p>The item you requested was not found.
+<p>The <%= req_item %> was not found.
 
-<% if controller.andand.action_name == 'show' %>
+<% if class_name %>
 Perhaps you'd like to
-<%= link_to("browse all #{controller.model_class.to_s.underscore.pluralize.humanize(capitalize: false)}",
-            action: :index) %>?
+<%= link_to("browse all #{class_name.pluralize}", action: :index) %>?
 <% end %>
 
 </p>
diff --git a/apps/workbench/test/integration/errors_test.rb b/apps/workbench/test/integration/errors_test.rb
index 0ec91aa..e373251 100644
--- a/apps/workbench/test/integration/errors_test.rb
+++ b/apps/workbench/test/integration/errors_test.rb
@@ -59,4 +59,19 @@ class ErrorsTest < ActionDispatch::IntegrationTest
     assert(page.has_no_text?(/fiddlesticks/i),
            "trying to show a bad UUID rendered a fiddlesticks page, not 404")
   end
+
+  test "404 page includes information about missing object" do
+    visit(page_with_token("active", "/groups/zazazaz"))
+    print page.html
+    assert(page.has_text?(/group with UUID zazazaz/i),
+           "name of searched group missing from 404 page")
+  end
+
+  test "unrouted 404 page works" do
+    visit(page_with_token("active", "/__asdf/ghjk/zxcv"))
+    assert(page.has_text?(/not found/i),
+           "unrouted page missing 404 text")
+    assert(page.has_no_text?(/fiddlesticks/i),
+           "unrouted request returned a generic error page, not 404")
+  end
 end

commit 8e4991b586e32c66cca8e608f066dc1575eda184
Author: Brett Smith <brett at curoverse.com>
Date:   Mon Jun 30 14:08:29 2014 -0400

    2891: Trying to show a non-UUID in Workbench renders 404.

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index f01c589..7d7ea95 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -356,7 +356,10 @@ class ApplicationController < ActionController::Base
       else
         @object = model_class.find(params[:uuid])
       end
-    rescue ArvadosApiClient::NotFoundException => error
+    rescue ArvadosApiClient::NotFoundException, RuntimeError => error
+      if error.is_a?(RuntimeError) and (error.message !~ /^argument to find\(/)
+        raise
+      end
       render_not_found(error)
       return false
     end
diff --git a/apps/workbench/test/integration/errors_test.rb b/apps/workbench/test/integration/errors_test.rb
index f6a34bc..0ec91aa 100644
--- a/apps/workbench/test/integration/errors_test.rb
+++ b/apps/workbench/test/integration/errors_test.rb
@@ -53,4 +53,10 @@ class ErrorsTest < ActionDispatch::IntegrationTest
            "Not on an error page after making an SSH key out of scope")
     assert(page_has_error_token?(start_stamp), "no error token on 404 page")
   end
+
+  test "showing a bad UUID returns 404" do
+    visit(page_with_token("active", "/pipeline_templates/zzz"))
+    assert(page.has_no_text?(/fiddlesticks/i),
+           "trying to show a bad UUID rendered a fiddlesticks page, not 404")
+  end
 end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list