Why not just trap for the error?

What is the error number you get?