Catch errors when running erlang-mode hook for new attach processes.