tools/tb2err
author Jonas Schäfer <jonas@wielicki.name>
Mon, 03 Oct 2022 12:55:11 +0200
changeset 12743 0dc80024fdd2
parent 11195 13e2ac7b5798
child 13067 414952def2d3
permissions -rwxr-xr-x
Backed out changeset 1bc2220cd6ec The use of the error helpers creates an `<error/>` child element containing the error condition. This is however not allowed as per XEP-0198, which specifies that the error condition is to be a direct child of the `<failed/>` stream management element. This has triggered a fun reconnect loop in aioxmpp where it was reported by a user [1]. [1]: https://github.com/horazont/aioxmpp/issues/382

#!/usr/bin/env lua-any
-- Lua-Versions: 5.3 5.2 5.1
-- traceback to errors.err for vim -q
local path_sep = package.config:sub(1,1);
for line in io.lines() do
	local src, err = line:match("%s*(%S+)(:%d+: .*)")
	if src then
		src = src:gsub("\\", path_sep);
		local cut = src:match("/()core/")
			or src:match("/()net/")
			or src:match("/()util/")
			or src:match("/()modules/")
			or src:match("/()plugins/")
			or src:match("/()prosody[ctl]*$") 
		if cut then
			src = src:sub(cut);
		end
		src = src:gsub("^modules/", "plugins/")
		io.write(src, err, "\n");
	end
end