First version of error diagnosis, for string errors