improved error reporting when edit function fails