summaryrefslogtreecommitdiff
path: root/helpers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'helpers.rb')
-rw-r--r--helpers.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/helpers.rb b/helpers.rb
index 1f106a7..09b0d42 100644
--- a/helpers.rb
+++ b/helpers.rb
@@ -136,7 +136,14 @@ helpers do
response = curl(
"-H 'Accept: #{accept}' -H 'Host: #{uri.host}' -H 'Date: #{httpdate}' -H 'Signature: #{signed_header}' ", url
)
- response ? JSON.parse(response) : nil
+ return unless response
+
+ begin
+ JSON.parse(response)
+ rescue StandardError => e
+ p url, e
+ nil
+ end
end
def curl(ext, url)
@@ -144,7 +151,7 @@ helpers do
if $CHILD_STATUS.success?
response
else
- p 'curl error:', url, response
+ p 'Curl Error:', url, response
nil
end
end