fixes #7, better error handling

Added exception handling if a template compilation failed