1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-29 10:59:02 +00:00

Fix the documentation for nmap.new_try, because it was incorrect. The result of

nmap.new_try is not a function accepting another function, it is a function
taking a variable number of arguments, assumed to be the return value of some
function. In other words, the returned try function is not responsible for
running other functions, it only sees their return values.
This commit is contained in:
david
2008-10-16 22:21:08 +00:00
parent aa87f1db15
commit 06b661f2ef
2 changed files with 18 additions and 16 deletions

View File

@@ -1256,9 +1256,11 @@ end
follows a functional programming paradigm rather than an
object oriented programming paradigm. To create an exception
handler the <literal>nmap.new_try()</literal> API method is
used. This method returns a function, which takes a function
as an argument. If the function passed as an argument raises
an exception, then the script execution is aborted and no
used. This method returns a function, which takes a variable
number of arguments, assumed to be the return values of
another function. If an exception is detected in the return
values (the first return value is false),
then the script execution is aborted and no
output is produced. Optionally you can pass a function to
the <literal>new_try()</literal> method which will be called
if an exception is caught. In this function you can perform
@@ -1309,7 +1311,8 @@ try(socket:send(result))
construct consumes the indicator value and returns the
remaining values. If the function failed then the second
returned value must be a string describing the error
condition. Note that if the value is not <literal>nil</literal> it is
condition. Note that if the value is not
<literal>nil</literal> or <literal>false</literal> it is
treated as <literal>true</literal> so you can return your
value in the normal case and return <literal>nil, <replaceable>error description</replaceable></literal>
if an error occurs.