From ba38367eff01afc7bef608da79d4282e40b918c0 Mon Sep 17 00:00:00 2001 From: ocelot-inc <pgulutzan@ocelot.ca> Date: Fri, 25 Jul 2014 16:25:45 -0600 Subject: [PATCH] databases.xml box.error --- doc/user/databases.xml | 99 ++++++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 46 deletions(-) diff --git a/doc/user/databases.xml b/doc/user/databases.xml index 507feac51e..ef8c9fe126 100644 --- a/doc/user/databases.xml +++ b/doc/user/databases.xml @@ -1536,52 +1536,6 @@ The result will be a table of tuples and will look like this: </listitem> </varlistentry> -</variablelist> -</section> - -<section xml:id="sp-error"> - <title>Package <code>error</code></title> -<variablelist xml:id="error" xreflabel="error"> - - <varlistentry> - <term> - <emphasis role="lua">error.raise(<replaceable>errcode-number, errtext-string</replaceable>)</emphasis> - </term> - <listitem> - <para> - Raises a client error. The difference between this function - and the built-in <code>error()</code> function in Lua - is that when the error reaches the client, its error code - is preserved, whereas every Lua error is presented to the - client as <constant>ER_PROC_LUA</constant>. This function - makes it possible to emulate any kind of native exception, - such as unique constraint violation, no such space/index, - etc. A complete list of errors is present in the file <link xlink:href="https://github.com/tarantool/tarantool/blob/master/src/errcode.h"><filename>errcode.h</filename></link> - in the source tree. - Lua constants which correspond to Tarantool errors - are defined in the <code>error.error</code> module. The error - message can be arbitrary. - Lua function can use <code>error.raise()</code> to emulate - request errors (for example: unique key exception). - When called without arguments this function re-throws the last - thrown error. - </para> - <para> - Parameters: <code>errcode-number</code> = number taken from the complete list of errors, - <code>errtext-string</code> = the message which will accompany the error. - </para> - <para> - Possible errors: whatever is specified in errcode-number. - </para> - <bridgehead renderas="sect4">Example</bridgehead> -<programlisting>tarantool> <userinput>error.raise(box.error.NO_SUCH_SPACE, 'Error: No such space')</userinput> ---- -- error: 'Error: No such space' -... -</programlisting> - </listitem> - </varlistentry> - <varlistentry> <term> <emphasis role="lua">box.space.<replaceable>space-name</replaceable>.auto_increment{<replaceable>field-value [, field-value ...]</replaceable>}</emphasis> @@ -1759,6 +1713,59 @@ session.delimiter('')! </section> +<section xml:id="sp-error"> + <title>Package <code>box.error</code></title> +<variablelist xml:id="error" xreflabel="error"> + <varlistentry> + <term> + <emphasis role="lua">box.error(<replaceable>errcode-number, errtext-string</replaceable>)</emphasis> + </term> + <listitem> + <para> + Raises a client error. The difference between this function + and the built-in <code>error()</code> function in Lua + is that when the error reaches the client, its error code + is preserved, whereas every Lua error is presented to the + client as <constant>ER_PROC_LUA</constant>. This function + makes it possible to emulate any kind of native exception, + such as unique constraint violation, no such space/index, + etc. A complete list of errors is present in the file <link xlink:href="https://github.com/tarantool/tarantool/blob/master/src/errcode.h"><filename>errcode.h</filename></link> + in the source tree. + Lua constants which correspond to Tarantool errors + are defined as members of <code>box.error</code>. The error + message can be arbitrary. + Lua function can use <code>box.error(...)</code> to emulate + request errors (for example: unique key exception). + When called without arguments this function re-throws the last + thrown error. + </para> + <para> + Parameters: <code>errcode-number</code> = number taken from the complete list of errors, + <code>errtext-string</code> = the message which will accompany the error. + </para> + <para> + Possible errors: whatever is specified in errcode-number. + </para> + <bridgehead renderas="sect4">Example</bridgehead> +<programlisting>tarantool> <userinput>tarantool> box.error(box.error,,'Tuple/Key must be MsgPack array')</userinput> +--- +- error: Tuple/Key must be MsgPack array +</programlisting> + </listitem> + </varlistentry> + <varlistentry> + <term> + <emphasis role="lua">box.error.rethrow()</emphasis> + </term> + <listitem> + <para> + Rethrow previous error. + </para> + </listitem> + </varlistentry> +</variablelist> +</section> + <section xml:id="sp-box-tuple"> <title>Package <code>box.tuple</code></title> <variablelist xml:id="box.tuple" xreflabel="box.tuple"> -- GitLab