diff options
| author | Diego Nehab <diego.nehab@gmail.com> | 2016-02-23 14:30:35 -0300 |
|---|---|---|
| committer | Diego Nehab <diego.nehab@gmail.com> | 2016-02-23 14:30:35 -0300 |
| commit | 9ffd96724da09352abe99c8525bbccb6bc34cb48 (patch) | |
| tree | 8d55377133839458dba7ff55b494146ab667e31d /doc | |
| parent | bf13ec7fd4fb05666964cf629e9b10591356ff67 (diff) | |
| parent | 7cab8a5006da807d83f427217e2158079bb78145 (diff) | |
| download | luasocket-9ffd96724da09352abe99c8525bbccb6bc34cb48.tar.gz luasocket-9ffd96724da09352abe99c8525bbccb6bc34cb48.tar.bz2 luasocket-9ffd96724da09352abe99c8525bbccb6bc34cb48.zip | |
Merge pull request #162 from siffiejoe/exception-meta
Support table errors in LuaSockets LTN13 C implementation.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/socket.html | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/doc/socket.html b/doc/socket.html index 8a81414..a43a208 100644 --- a/doc/socket.html +++ b/doc/socket.html | |||
| @@ -220,13 +220,6 @@ Returns an equivalent function that instead of throwing exceptions, | |||
| 220 | returns <tt><b>nil</b></tt> followed by an error message. | 220 | returns <tt><b>nil</b></tt> followed by an error message. |
| 221 | </p> | 221 | </p> |
| 222 | 222 | ||
| 223 | <p class=note> | ||
| 224 | Note: Beware that if your function performs some illegal operation that | ||
| 225 | raises an error, the protected function will catch the error and return it | ||
| 226 | as a string. This is because the <a href=#try><tt>try</tt></a> function | ||
| 227 | uses errors as the mechanism to throw exceptions. | ||
| 228 | </p> | ||
| 229 | |||
| 230 | <!-- select +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | 223 | <!-- select +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> |
| 231 | 224 | ||
| 232 | <p class=name id=select> | 225 | <p class=name id=select> |
| @@ -424,8 +417,7 @@ socket.<b>try(</b>ret<sub>1</sub> [, ret<sub>2</sub> ... ret<sub>N</sub>]<b>)</b | |||
| 424 | 417 | ||
| 425 | <p class=description> | 418 | <p class=description> |
| 426 | Throws an exception in case of error. The exception can only be caught | 419 | Throws an exception in case of error. The exception can only be caught |
| 427 | by the <a href=#protect><tt>protect</tt></a> function. It does not explode | 420 | by the <a href=#protect><tt>protect</tt></a> function. |
| 428 | into an error message. | ||
| 429 | </p> | 421 | </p> |
| 430 | 422 | ||
| 431 | <p class=parameters> | 423 | <p class=parameters> |
| @@ -436,7 +428,10 @@ nested with <tt>try</tt>. | |||
| 436 | 428 | ||
| 437 | <p class=return> | 429 | <p class=return> |
| 438 | The function returns <tt>ret</tt><sub>1</sub> to <tt>ret</tt><sub>N</sub> if | 430 | The function returns <tt>ret</tt><sub>1</sub> to <tt>ret</tt><sub>N</sub> if |
| 439 | <tt>ret</tt><sub>1</sub> is not <tt><b>nil</b></tt>. Otherwise, it calls <tt>error</tt> passing <tt>ret</tt><sub>2</sub>. | 431 | <tt>ret</tt><sub>1</sub> is not <tt><b>nil</b></tt> or <tt><b>false</b></tt>. |
| 432 | Otherwise, it calls <tt>error</tt> passing <tt>ret</tt><sub>2</sub> wrapped | ||
| 433 | in a table with metatable used by <a href=#protect><tt>protect</tt></a> to | ||
| 434 | distinguish exceptions from runtime errors. | ||
| 440 | </p> | 435 | </p> |
| 441 | 436 | ||
| 442 | <pre class=example> | 437 | <pre class=example> |
