Default Lua error type. Exceptions raised by Lua-related operations.
Modulehslua-core-2.3.2Haskell2010
HsLua.Core.Error
Lua exceptions and exception handling.
- 2 types
- 1 class
- 8 values
- Packagehslua-core-2.3.2
- Exports11
- LanguageHaskell2010
- LicenceMIT
- SourceError.hs
Any type that you wish to use for error handling in HsLua must be
an instance of the LuaError class.
Methods
popException :: LuaE e eConverts the error at the top of the stack into an exception and pops the error off the stack.
This function is expected to produce a valid result for any Lua value; neither a Haskell exception nor a Lua error may result when this is called.
pushException :: e -> LuaE e ()Pushes an exception to the top of the Lua stack. The pushed Lua object is used as an error object, and it is recommended that calling
tostring()on the object produces an informative message.luaException :: String -> eCreates a new exception with the given message.
A Lua operation.
This type is suitable for most users. It uses a default exception for error handling. Users who need more control over error handling can use LuaE with a custom error type instead.
Return either the result of a Lua computation or, if an exception was thrown, the error.
Raises an exception in the Lua monad.
Converts a Lua error at the top of the stack into a Haskell exception and throws it.
Raises an exception that's appropriate when the type of a Lua object at the given index did not match the expected type. The name or description of the expected type is taken as an argument.
Change the error type of a computation.
Helpers for hslua C wrapper functions.
3 declarationsTakes a failable HsLua function and transforms it into a monadic LuaE operation. Throws an exception if an error occured.
Retrieve and pop the top object as an error message. This is very similar to tostring', but ensures that we don't recurse if getting the message failed.
This helpful as a "last resort" method when implementing popException.
pushTypeMismatchError :: ByteStringname or description of expected type
-> StackIndexstack index of mismatching object
-> LuaE e ()
Creates an error to notify about a Lua type mismatch and pushes it to the stack.