From 639929efd7d169ab9804058104a6974b3616d321 Mon Sep 17 00:00:00 2001 From: Steven Chan Date: Mon, 15 Sep 2014 11:33:57 -0700 Subject: [PATCH] Fix handling of errors for downloading Overdrive Read format These sort of errors require parameters to be included with the error-handling URL, and a different format for the notification box. Signed-off-by: Steven Chan --- src/od_action.coffee | 5 ++--- src/overdrive.coffee | 11 +++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/od_action.coffee b/src/od_action.coffee index 8b330a1..a524544 100644 --- a/src/od_action.coffee +++ b/src/od_action.coffee @@ -451,10 +451,9 @@ define [ type: type } = format - x = encodeURIComponent window.location.href href = href - .replace /\{errorpageurl\}/, x - .replace /\{odreadauthurl\}/, x + .replace /\{errorpageurl\}/, encodeURIComponent window.location.href + .replace /\{odreadauthurl\}/, encodeURIComponent "#{window.location.href}&reserveid=[RESERVE_ID]&read_error=[READ_ERROR]" action = format.linkTemplates.downloadLink $.extend action, _of: $tr, _name: n, _id: id, href: href diff --git a/src/overdrive.coffee b/src/overdrive.coffee index ad440a6..ace8f18 100644 --- a/src/overdrive.coffee +++ b/src/overdrive.coffee @@ -383,10 +383,17 @@ require [ # If there is an error message embedded in the search parameters # that resulted from an attempt at downloading content, show it in # a floating notification box. - if code = search_params 'ErrorCode' + if code = search_params 'read_error' + $('
')._notify 'Error message', """ +

Could not get content

+
Error code: #{code}
+
Reserve ID: #{search_params 'reserveid'}
+ """ + else if code = search_params 'ErrorCode' $('
')._notify 'Error message', """

#{search_params 'ErrorDescription'}

-

Details: #{search_params 'ErrorDetails'}

+
Error code: #{code}
+
Details: #{search_params 'ErrorDetails'}
""" # Rewrite the text in the warning box to distinguish physical items from e-items -- 2.11.0