added error handling in edit.html