Catch errors and add filename to message