EWD

EWD
Login

EWD, which stands for Error Warning Debugging, is a Lua(JIT) module which aims to be a fundamental component of my methodology to deal with error handling, warning and debugging. At the moment, LuaJIT is the only target.

Aimed features:

API

Warning System

Warnings can be propagated just like errors, at the exception that they do not interrupt execution. As for errors, the warning message doesn't have to be a string.

ewd.warn(message [, level])

Similar to error, but for warnings. The warning is propagated to the last enclosing cwpcall warning handler (or the root handler). The execution is not interrupted.

ewd.wpcall(f, ...)

Similar to pcall, but the error caught is propagated as a warning.

ewd.cwpcall(f, err_handler, warn_handler, ...)

Similar to xpcall, but warn_handler is a warning handler that will catch warnings.

Callbacks:

If err_handler is the "warn" string, the error will be propagated as a warning to the handler above the current warning handler (warn_handler).

Note: If the warning handler raises an error, it will be caught by the error handler.

ewd.warning_handler

The root warning handler called when there is no enclosing cwpcall.

The default handler writes to stderr. It can be replaced.