aboutsummaryrefslogtreecommitdiff
path: root/src/except.h
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-06-15 06:24:00 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-06-15 06:24:00 +0000
commit58096449c6044b7aade5cd41cfd71c6bec1d273d (patch)
tree1814ffebe89c4c2556d84f97f66db37a7e8b4554 /src/except.h
parent9ed7f955e5fc69af9bf1794fa2c8cd227981ba24 (diff)
downloadluasocket-58096449c6044b7aade5cd41cfd71c6bec1d273d.tar.gz
luasocket-58096449c6044b7aade5cd41cfd71c6bec1d273d.tar.bz2
luasocket-58096449c6044b7aade5cd41cfd71c6bec1d273d.zip
Manual is almost done. HTTP is missing.
Implemented new distribution scheme. Select is now purely C. HTTP reimplemented seems faster dunno why. LTN12 functions that coroutines fail gracefully.
Diffstat (limited to 'src/except.h')
-rw-r--r--src/except.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/except.h b/src/except.h
new file mode 100644
index 0000000..2c57b27
--- /dev/null
+++ b/src/except.h
@@ -0,0 +1,35 @@
1#ifndef EXCEPT_H
2#define EXCEPT_H
3/*=========================================================================*\
4* Exception control
5* LuaSocket toolkit (but completely independent from other modules)
6*
7* This provides support for simple exceptions in Lua. During the
8* development of the HTTP/FTP/SMTP support, it became aparent that
9* error checking was taking a substantial amount of the coding. These
10* function greatly simplify the task of checking errors.
11*
12* The main idea is that functions should return nil as its first return
13* value when it finds an error, and return an error message (or value)
14* following nil. In case of success, as long as the first value is not nil,
15* the other values don't matter.
16*
17* The idea is to nest function calls with the "try" function. This function
18* checks the first value, and calls "error" on the second if the first is
19* nil. Otherwise, it returns all values it received.
20*
21* The protect function returns a new function that behaves exactly like the
22* function it receives, but the new function doesn't throw exceptions: it
23* returns nil followed by the error message instead.
24*
25* With these two function, it's easy to write functions that throw
26* exceptions on error, but that don't interrupt the user script.
27*
28* RCS ID: $Id$
29\*=========================================================================*/
30
31#include <lua.h>
32
33int except_open(lua_State *L);
34
35#endif