add error handler before setting file.src