Added wrapper to handle common exceptions in scripts