Fix 5896

- which() is not valid for anonymous functions
- make showerror(.., ::MethodError) safer by checking for anonymous function.
  error message is not super helpful, but avoids the bizarre backtrace.
  `e.f.env == ()` for anonymous function, hence getfield error.
Merge pull request #5907 from ihnorton/fix5896

Fix 5896