finalisation if error occur
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: finalisation if error occur
- From: Markus Huber <pulse@...>
- Date: 2004年7月12日 13:46:11 +0200 (BST)
With this example the finalisation runs perfect as long as no error
occured. <file> is the main programm and if Script() ends then the
function Finalise() is called. But how can I fetch errors so that:
1. the original error is documentated in the error logs
as good as standard behaviour (traceback)
2. Finalise() is called
domcument errors now like Lua original
3. end
function Finalise()
-- do something
end
do
local Script,Error=loadfile(<file>)
if Script then
Script()
Finalise()
else
io.write(Error)
end
end
--
Markus