Adding error message and clear contents on error.