Do I have to rescue exceptions inside my loop using Ruby? -
i learning more , more ruby , have written script times out on occassion (making several api calls).
i know need rescue
exception this:
rescue timeout::error => e # log #{e} later, maybe end
my question should place rescue
block. since making several api calls within multiple loops, need put block within each api loop? prefer write rescue
block once, @ end of script example, , have work inside each loop in script. using ruby 1.9.3.
it depends of try errors.
for example, if want errors not abort loop run, catch exception inside loop, can log error , continue next iteration.
if error kind of "fatal" , cannot (or don't want to) continue loop, catch outside.
Comments
Post a Comment