I'm not asking about how to use the begin..rescue statement in Ruby. Rather, I'm asking how do you figure out what's worth worrying about. I know some hardcore people probably go through the documentation/code to find every single possible error, and have code that handles all cases gracefully. But that might be going too far if you're not writing something "mission-critical".
So how do you know what errors to look out for? I generally just run my code, and if it stops due to an error, I add a begin..rescue statement. I'm sure there has to be a better way though. I just ran a script to import data into a database for some files, and it stopped after an hour (lots of files, don't ask) due to some error that I couldn't know was going to occur. Quite annoying, and I'm sure it's my fault for not writing more robust code. How do I do that?