Page 1 of 1

[Rseding91] [0.17.38] Not Helpful Crash Message

Posted: Fri May 10, 2019 6:57 pm
by Cooldude2606
Was busy making a scenario when an update must have broken something; I check log for details for where I was casuing an error but nothing of use was included:

Code: Select all

1002.674 Error MainLoop.cpp:1173: Exception at tick 0: Unable to parse LocalisedString: given table is empty.
1002.674 Error ServerMultiplayerManager.cpp:92: MultiplayerManager failed: "Unable to parse LocalisedString: given table is empty."
1002.674 Info ServerMultiplayerManager.cpp:776: updateTick(0) changing state from(InGame) to(Failed)
And in game it is no help either:
Image

Could you please make this more detailed by maybe including a stacktrace so that I dont have to go through every scenario file enabling and disabling things to find what does and doesnt cause the error.

After much searching I found what was casuing the error: I was calling error with a table by mistake when the varible should have been a string, however this still took some time to find due to the lack of a stack trace it was also strange how I was calling error from within a pcall enviroment and it still caused the game to error and crash, this may also be a second bug as a result of this.

Re: [0.17.38] Not Helpful Crash Message

Posted: Fri May 10, 2019 7:38 pm
by Cooldude2606
Update: after reading through more code I found that the point I made about escaping the pcall was not true and that the error was caused by pcall returning the table which I raised with error. The reason it crashed was because log was called with a empty table (outside the pcall) however a stack trace would still have helped here.

Re: [0.17.38] Not Helpful Crash Message

Posted: Fri May 10, 2019 8:02 pm
by Rseding91
Can you give me a save file that reproduces this error?

Re: [0.17.38] Not Helpful Crash Message

Posted: Fri May 10, 2019 10:04 pm
by Cooldude2606
Add this code to the control.lua and it will cause the error with no stack trace, you can change the error({}) to error('foo') and see that a stack trace is produced and that is only when log is given an empty table that no stack trace is produced.

Code: Select all

local function log_errors(callback)
	local success, err = pcall(callback)
	if not success then
		-- err = {} -- empty table causes the locale error but with no stack trace
		-- err = 'foo' -- logs error 'foo' with stack trace which includes ln6 and ln12
		log(err) --ln6
	end
end

local function stack_two()
	-- return error with {} as the error message, this was the mistake i made
	return error({}) --ln12
end

local function stack_one()
	return stack_two()
end

script.on_event(defines.events.on_tick,function()
	log_errors(stack_one)
end)

Re: [0.17.38] Not Helpful Crash Message

Posted: Tue May 14, 2019 6:39 am
by Rseding91
Thanks for the code. It's now fixed for the next version of 0.17.