Skip to content

Commit

Permalink
Merge pull request #70 from cul-it/appsignal
Browse files Browse the repository at this point in the history
Empty database table check
  • Loading branch information
Baroquem authored Aug 24, 2016
2 parents 0311e07 + 7eabf89 commit babb726
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@

module BlacklightCornellRequests

class RequestDatabaseException < StandardError
attr_reader :data

def initialize(data)
super
@data = data
end
end

class RequestController < ApplicationController

include Blacklight::SolrHelper
include Cornell::LDAP

def magic_request target=''

@id = params[:bibid]
Expand All @@ -15,6 +24,17 @@ def magic_request target=''

Rails.logger.debug "Viewing item #{@id} (within request controller) - session: #{session}"

# Do a check to see whether the circ_policy_locs table is populated — for some
# bizarre reason, it has been turning up empty in production.
begin
if Circ_policy_locs.count() > 1
raise BlacklightCornellRequests::RequestDatabaseException, 'circ_policy_locs table has less than one row'
end
rescue BlacklightCornellRequests::RequestDatabaseException => e
Rails.logger.error "Requests database exception: #{e}"
Appsignal.add_exception(e)
end

# If the holdings data has been stored in the session (:holdings_status_short),
# we'll pass it in to the request to be reused instead of making
# the expensive holdings service call again. As soon as it's used, the session
Expand Down
2 changes: 1 addition & 1 deletion lib/blacklight_cornell_requests/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module BlacklightCornellRequests
VERSION = "1.2.5"
VERSION = "1.2.6"
end
3 changes: 3 additions & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release Notes - blacklight-cornell-requests

## v1.2.6
- Added a check for empty circ_policy_locs database table with AppSignal integration

## v1.2.5

### Bug fixes
Expand Down

0 comments on commit babb726

Please sign in to comment.