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.

closes #5896