adding better error handling to the ScriptGenerator

not yet complete