Untitled

 avatar
unknown
ruby
a year ago
495 B
6
Indexable
## Good
def retry
  WebHooks::Events::ResendService.new(hook_log).execute
  redirect_to after_retry_redirect_path
rescue StandardError => e
  flash[:warning] = e.message
  redirect_back(fallback_location: after_retry_redirect_path)
end

## Bad
def retry
  begin
    WebHooks::Events::ResendService.new(hook_log).execute
    redirect_to after_retry_redirect_path
  rescue StandardError => e
    flash[:warning] = e.message
    redirect_back(fallback_location: after_retry_redirect_path)
  end
end
Editor is loading...
Leave a Comment