lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


With FusionScript, I'm doing something similar where a ConfigReadError has an attribute `reason` which could be an IOError(), along with other such things. A __tostring might report this weirdly, so that might be a slight issue.

On Fri, Feb 24, 2017, 02:08 steve donovan <steve.j.donovan@gmail.com> wrote:
On Fri, Feb 24, 2017 at 12:44 AM, Soni L. <fakedme@gmail.com> wrote:
> Propagate is a module for cleanly propagating error/status codes to the
> caller.

Here's an idea for error handling. I've been playing with Rust, which
is famous for not having exceptions. There's an external library
called error-chain which does something very cool; when you have an
I/O error, you can chain the error so that you return _your_ error,
which contains a list of errors that _caused_ your error.  So you can
return 'cannot open contacts file' as an error which contains the
original i/o error, etc.

--
--

Ryan <vandor2012@gmail.com>
Software Developer / System Administrator
https://hashbang.sh