scansion/error.lua

Fri, 28 Dec 2018 04:41:09 -0500

author
Waqas Hussain <waqas20@gmail.com>
date
Fri, 28 Dec 2018 04:41:09 -0500
changeset 160
28aa762f11c7
parent 111
25530dccf696
permissions
-rw-r--r--

Include line_start and line_end in action objects and action log events for /run end-point

local error_mt = {
	__tostring = function (e)
		return tostring(e.text or e.type or ("<Scansion error: "..tostring(e)..">"));
	end;
	__name = "scansion error";
};

return {
	new_error = function (type, data)
		return setmetatable({ type = type, text = data.text, data = data }, error_mt);
	end;
	is = function (err)
		return getmetatable(err) == error_mt;
	end;
};

mercurial