better error handling for deploy script