Ruby on rails 是否可能忽略一行代码并在崩溃时重新加载页面?

Ruby on rails 是否可能忽略一行代码并在崩溃时重新加载页面?,ruby-on-rails,json,soundcloud,Ruby On Rails,Json,Soundcloud,我使用名为auto_html的gem嵌入了soundcloud URL。我的网站偶尔会随机崩溃,并出现一个错误,这似乎是soundcloud上流量过多导致的超时请求?有没有办法在请求超时时忽略嵌入文件的代码行并重新加载页面 错误: JSON::ParserError ActionView::Template::Error (757: unexpected token at '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http:

我使用名为auto_html的gem嵌入了soundcloud URL。我的网站偶尔会随机崩溃,并出现一个错误,这似乎是soundcloud上流量过多导致的超时请求?有没有办法在请求超时时忽略嵌入文件的代码行并重新加载页面

错误:

JSON::ParserError

ActionView::Template::Error (757: unexpected token at '<!DOCTYPE HTML PUBLIC 
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

          We were unable to process your request in time - SoundCloud
          Yikes, we were unable to process your request in time.
          Please reload the page or try again in a moment.
JSON::parserror
ActionView::Template::错误(757:在'
我们无法及时处理您的请求-SoundCloud
Yikes,我们无法及时处理您的请求。
请重新加载页面或稍后重试。
要在视图中忽略的代码:

41:        <% if micropost.url.include? 'soundcloud' %>
42:          <%= auto_html(micropost.url) {soundcloud}  %>
43:        <% end %> 
41:
42:          
43:         

我想您可以创建一个帮助器方法,该方法将“执行”auto_html帮助器方法并返回其结果。在该方法中,您可以使用begin、rescue和on error围绕调用,您可以返回一个js来重新加载(window.location.href…)


我不知道你是否可以通过helper方法重定向,如果可以,那就更容易了。

我想我可以使用rails重定向到方法?如果你有时间,你可以给我一个如何使用故障救援的例子