error handling for nlp