You want to wrap this (and everything under it) in a try .. catch I think