HPCC-8842 Improve error message for code that would fail

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>