Untitled

mail@pastecode.io avatar
unknown
ruby
2 months ago
495 B
3
Indexable
Never
## 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
Leave a Comment