Skip to content

Commit

Permalink
Merge pull request #1810 from sul-dlss/1765-remove-hb-notify
Browse files Browse the repository at this point in the history
Only notify HB of full text link errors when the user is not a guest.
  • Loading branch information
mejackreed authored Sep 22, 2017
2 parents 7fd2aa1 + 70df594 commit 067abab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/articles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def fulltext_link
url = extract_fulltext_link(document, params[:type])
redirect_to url if url.present?
rescue => e
Honeybadger.notify(e) if defined? Honeybadger
Honeybadger.notify(e) if defined?(Honeybadger) && !session['eds_guest']
flash[:error] = flash_message_for_link_error
redirect_back fallback_location: articles_path
end
Expand Down
12 changes: 12 additions & 0 deletions spec/controllers/article_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@
expect(error_message).to have_content('Log in to try the download again')
expect(response).to have_http_status(:found) # redirects back
end

it 'does not send an exception to Honeybadger (because this can be expected)' do
expect(Honeybadger).not_to receive(:notify)

get :fulltext_link, params: { id: '123', type: :pdf }
end
end

context 'when the user is not in guest mode' do
Expand All @@ -87,6 +93,12 @@
expect(error_message).to have_css('a', text: 'please report it as a connection problem')
expect(response).to have_http_status(:found) # redirects back
end

it 'sends and exception notification' do
expect(Honeybadger).to receive(:notify)

get :fulltext_link, params: { id: '123', type: :pdf }
end
end
end

Expand Down

0 comments on commit 067abab

Please sign in to comment.