Skip to content

Commit

Permalink
improve BD error messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
tworrall committed Mar 25, 2021
1 parent f034ebc commit dbda83e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -453,12 +453,16 @@ def make_bd_request
req = BlacklightCornellRequests::CULBorrowDirect.new(requester, work, add_request)
resp = req.request_from_bd(params)
body_hash = JSON[resp.body]
if resp
if resp.is_a?(Net::HTTPSuccess)
status = 'success'
status_msg = I18n.t('requests.success') + " The Borrow Direct request number is #{body_hash['RequestNumber']}."
else
status = 'failure'
status_msg = "There was an error when submitting this request to Borrow Direct. Your request could not be completed."
if !body_hash['Problem'].nil? && body_hash['Problem']['Message'].present?
status_msg = body_hash['Problem']['Message']
else
status_msg = "There was an error when submitting this request to Borrow Direct. Your request could not be completed."
end
end
end

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 = "3.4.3"
VERSION = "3.4.4"
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

## v3.4.4
- Display the BD error message when possible to provide more context. (DISCOVERYACCESS-6967)

## v3.4.3
- Use the new Borrow Direct 'Add Request' API. (DISCOVERYACCESS-6890)

Expand Down

0 comments on commit dbda83e

Please sign in to comment.