Error handling, temporarily replacing _ERRORMESSAGE

I want to test some functions that are causing errors by executing them in protected mode. From the docs:

Here is my code in HGN “ai_build.lua”:

call(NumSquadrons,{kCollector},"x",temperror)

and the function:

function temperror(e)
	print("lalala")
end

Instead of “lalala” in the log, I get the message, “Cannot overwrite function _ERRORMESSAGE”.

I get the same error when supplying nil instead of a function. E.g.

call(NumSquadrons,{kCollector},"x",nil)

The rest of the script does not break since it is protected.

Has anyone messed with this stuff before?