Write backtrace in top-level rescue blocks.

This commit is contained in:
Prad Nelluru 2020-04-19 02:24:09 -04:00
parent 483f838d24
commit 5d9d951c9a
1 changed files with 3 additions and 2 deletions

View File

@ -79,13 +79,14 @@ module Muse::Dl
delay_secs /= 2
end
rescue ex : Muse::Dl::Errors::DownloadError
puts ex
puts ex.backtrace.join("\n ")
puts "Download error. Skipping book: #{url}. Waiting for #{delay_secs} seconds before continuing."
# Sleep to prevent hammering the server.
sleep(delay_secs)
delay_secs *= 2
rescue ex
puts ex
puts ex.backtrace.join("\n ")
pp ex
puts "Non-download error. Skipping book: #{url}."
sleep(1)
end