blob: aed52e549d62caae95dd9cb987ef1884654f67ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
--[[
User error handling for Alpine Wall
Copyright (C) 2012-2013 Kaarle Ritvanen
See LICENSE file for license details
]]--
module(..., package.seeall)
local prefix = 'awall user error: '
function raise(msg) error(prefix..msg) end
function call(f, ...)
return xpcall(
function() f(unpack(arg)) end,
function(msg)
local si, ei = string.find(msg, prefix, 1, true)
if si then msg = 'awall: '..string.sub(msg, ei + 1, -1) end
io.stderr:write(msg..'\n')
if not si then io.stderr:write(debug.traceback()..'\n') end
end
)
end
|