Catch render errors and display 'Couldn't find anything' instead of stacktrace

This commit is contained in:
Pfingstfrosch 2020-05-29 16:12:23 +02:00
parent f96ed67cf0
commit 84cf537412
3 changed files with 34 additions and 22 deletions

View File

@ -1,20 +1,24 @@
<h1>Results for "<%= params[:search_term] %>"</h1> <h1>Results for "<%= params[:search_term] %>"</h1>
<ul class="courses-list"> <ul class="courses-list">
<% @courses.each_with_index do |course| %> <% if @courses %>
<li class="course"> <% @courses.each_with_index do |course| %>
<%= link_to crawlers_courses_crawler_show_detail_url(:title => course['title'], :detail_url => course['detail_url']) do %> <li class="course">
<span class="list-link"> <%= link_to crawlers_courses_crawler_show_detail_url(:title => course['title'], :detail_url => course['detail_url']) do %>
<span class="course-title"> <span class="list-link">
<%= course['title'] %> <span class="course-title">
<%= course['title'] %>
</span>
</span> </span>
</span> <% end %>
<% end %> <span class="add-to-fav">
<span class="add-to-fav">
<%= link_to crawlers_courses_crawler_add_to_fav_url(:title => course['title'], :detail_url => course['detail_url']) do %> <%= link_to crawlers_courses_crawler_add_to_fav_url(:title => course['title'], :detail_url => course['detail_url']) do %>
<%= show_svg('favorite-24px.svg') %> <%= show_svg('favorite-24px.svg') %>
<% end %> <% end %>
</span> </span>
</li> </li>
<% end %>
<% else %>
Could not find anything... Please try again.
<% end %> <% end %>
</ul> </ul>

View File

@ -1,20 +1,24 @@
<h1>Results for "<%= params[:search_term] %>"</h1> <h1>Results for "<%= params[:search_term] %>"</h1>
<ul class="projects-list"> <ul class="projects-list">
<% @projects.each_with_index do |project| %> <% if @projects %>
<li class="project"> <% @projects.each_with_index do |project| %>
<%= link_to crawlers_projects_crawler_show_detail_url(:id => project['id'], :title => project['title']) do %> <li class="project">
<%= link_to crawlers_projects_crawler_show_detail_url(:id => project['id'], :title => project['title']) do %>
<span class="list-link"> <span class="list-link">
<span class="project-title"> <span class="project-title">
<%= project['title'] %> <%= project['title'] %>
</span> </span>
</span> </span>
<% end %> <% end %>
<span class="add-to-fav"> <span class="add-to-fav">
<%= link_to crawlers_projects_crawler_add_to_fav_url(:id => project['id'], :title => project['title']) do %> <%= link_to crawlers_projects_crawler_add_to_fav_url(:id => project['id'], :title => project['title']) do %>
<%= show_svg('favorite-24px.svg') %> <%= show_svg('favorite-24px.svg') %>
<% end %> <% end %>
</span> </span>
</li> </li>
<% end %>
<% else %>
Could not find anything... Please try again.
<% end %> <% end %>
</ul> </ul>

View File

@ -1,20 +1,24 @@
<h1>Results for "<%= params[:search_term] %>"</h1> <h1>Results for "<%= params[:search_term] %>"</h1>
<ul class="theses-list"> <ul class="theses-list">
<% @theses.each_with_index do |thesis| %> <% if @theses %>
<li class="thesis"> <% @theses.each_with_index do |thesis| %>
<%= link_to crawlers_theses_crawler_show_detail_url(:id => thesis['id'], :title => thesis['title']) do %> <li class="thesis">
<%= link_to crawlers_theses_crawler_show_detail_url(:id => thesis['id'], :title => thesis['title']) do %>
<span class="list-link"> <span class="list-link">
<span class="thesis-title"> <span class="thesis-title">
<%= thesis['title'] %> <%= thesis['title'] %>
</span> </span>
</span> </span>
<% end %> <% end %>
<span class="add-to-fav"> <span class="add-to-fav">
<%= link_to crawlers_theses_crawler_add_to_fav_url(:id => thesis['id'], :title => thesis['title']) do %> <%= link_to crawlers_theses_crawler_add_to_fav_url(:id => thesis['id'], :title => thesis['title']) do %>
<%= show_svg('favorite-24px.svg') %> <%= show_svg('favorite-24px.svg') %>
<% end %> <% end %>
</span> </span>
</li> </li>
<% end %>
<% else %>
Could not find anything... Please try again.
<% end %> <% end %>
</ul> </ul>