[enh] Issue 8948 - Make error message more readable for function/delegate errors

This is a reimplementation of Pull #1248 which wasn't good because it was breaking IDE tools.

This pull keeps the error message on one line, but also prints additional information for several distinct cases.