Printing error message on write