util.serialization: Encode non-fatal error in way that can be restored

It could previously encode to eg `{ [nil] = ... }` which doesn't get decoded
This commit is contained in:
Kim Alvefur 2018-10-27 12:56:01 +02:00
parent 1497806989
commit a261de73b9

View file

@ -39,7 +39,7 @@ local function fatal_error(obj, why)
end
local function nonfatal_fallback(x, why)
return s_format("nil --[[%s: %s]]", type(x), why or "fail");
return s_format("{__type=%q,__error=%q}", type(x), why or "fail");
end
local string_escapes = {