Re: [suggestion] assert: accept functions as "message"-argument
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: [suggestion] assert: accept functions as "message"-argument
- From: Wolfgang Pupp <wolfgang.pupp@...>
- Date: 2013年1月14日 23:52:59 +0100
Jorge wrote:
> And what to do when your error handling function errors?
You pcall the function that should provide the error message, and if
it fails, you just display a generic message, like
[...] assertion failed (another error while retrieving the error message)
<stacktrace>
or
[...] assertion failed (retrieved error message has wrong type: <type>
instead of string)
<stacktrace>
I would leave the stacktrace as-is now (if the developer wants to debug
his error-string function, he can always place additional asserts).
Issues like this would make it even more helpful to have this
functionality inside Lua itself: with every library author making their
own assert-variants, such details might often be overlooked and *really*
confuse novice Lua-users.
--Wolfgang