Yup, all goes in the macro. Get rid of the m6. at the beginning of the errorOut function name and where it is called.
function m6()
	local inst = mc.mcGetInstance()
	local rc = -40
	--local selectedTool = mc.mcToolGetSelected(inst)
	--local currentTool = mc.mcToolGetCurrent(inst)
	--local maxDown = -4.0000 --Max distance Z will go down in the touch routine
	--local rate = 30 --Feed rate the Z will go down in the touch routine
	--local safeZ = 0 --Machine coordinates the Z will rapid to after touch move
	--
	--if selectedTool == currentTool then
	--	mc.mcCntlSetLastError(inst, "Current tool == Selected tool so there is nothing to do")
	--else
	--	--Remove this line if you would not like the Z axis to move
	--	--mc.mcCntlGcodeExecute(inst, "G90 G53 G0 Z0.0");--Move the Z axis all the way up
	--	mc.mcCntlSetLastError(inst, "Change to tool " .. tostring(selectedTool) .. " and press start to touch off") --Message at beginning of tool change
	--	mc.mcCntlToolChangeManual(inst, true) --This will pause the tool change here and wait for a press of cycle start to continue
	--	mc.mcToolSetCurrent(inst, selectedTool)
	--	mc.mcCntlSetLastError(inst, "Performing touch routine")
	--	mc.mcCntlGcodeExecuteWait(inst, string.format("G31 Z%0.4f F%0.4f\nG0 G53 Z%0.4f", tostring(maxDown), tostring(rate), tostring(safeZ)))
	--	mc.mcCntlSetLastError(inst, "Touch move complete")
	--	mc.mcCntlSetLastError(inst, "Current tool == " .. tostring(selectedTool) .. "   Previous Tool == " .. tostring(currentTool)) --Message that shows after Cycle Start
	--	local didStrike, rc = mc.mcCntlProbeGetStrikeStatus(inst)
	--	if (didStrike == 1) then
	--		--5063 = User position 5073 = Machine position
	--		value, rc = mc.mcCntlGetPoundVar(inst, 5063)
	--		mc.mcToolSetData(inst, mc.MTOOL_MILL_HEIGHT, selectedTool, value)
	--		mc.mcCntlGcodeExecute(inst, string.format("G43 H" .. tostring(selectedTool)))
	--		mc.mcCntlSetLastError(inst, string.format("Tool " .. tostring(selectedTool) .. " H offset set to %0.4f", value))
	--	else
	--		mc.mcCntlSetLastError(inst, "The touch move did not touch so we did not set a tool offset.") --Message that shows after Cycle Start
	--	end
	--end
	--Put this in your macros function
	if (rc ~= 0) then
		msg = mc.mcCntlGetErrorString(inst, rc) --Get the returned error string
		errorOut(msg) --Run the m6.errorOut function passing it the msg parameter
		return --Exit the function this is in
	end
end
--Add this function
function errorOut(msg)
	local inst = mc.mcGetInstance()
	mc.mcCntlMacroAlarm(inst, 3, msg)
end
if (mc.mcInEditor() == 1) then
	m6()
end