From 908ab2686502cce5eaa6b1630bacfe2fb58ba447 Mon Sep 17 00:00:00 2001 From: "a.ardeev" Date: Wed, 14 May 2025 14:35:21 +0300 Subject: [PATCH 1/4] Add description of the ``name`` parameter Since 3.1.0 there has been the ``name`` parameter,which returns the name of the error used at creation. Fixes #4150 --- doc/reference/reference_lua/box_error/error_object.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/reference/reference_lua/box_error/error_object.rst b/doc/reference/reference_lua/box_error/error_object.rst index 93266c3e03..47b665ef21 100644 --- a/doc/reference/reference_lua/box_error/error_object.rst +++ b/doc/reference/reference_lua/box_error/error_object.rst @@ -189,3 +189,13 @@ error_object For the ``box.error.READONLY`` error, returns the current election term (see :ref:`box.info.election.term `). This attribute may present if the :ref:`error reason ` is ``election`` or ``synchro``. + + .. _box_error-name: + + .. data:: name + + **Since:** :doc:`3.1.0 ` + + Returns the name of the error used at creation. + + From c170d0a05e6f9a7ab1cd59abc66a699dacd3da1c Mon Sep 17 00:00:00 2001 From: "a.ardeev" Date: Wed, 14 May 2025 16:12:29 +0300 Subject: [PATCH 2/4] Add description of box.error.is function Function allows check whether the argument is an error. Added as a new page Fixes #4236 --- doc/reference/reference_lua/box_error.rst | 4 +++ doc/reference/reference_lua/box_error/is.rst | 28 ++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 doc/reference/reference_lua/box_error/is.rst diff --git a/doc/reference/reference_lua/box_error.rst b/doc/reference/reference_lua/box_error.rst index 7202ae13e5..38cca8fe26 100644 --- a/doc/reference/reference_lua/box_error.rst +++ b/doc/reference/reference_lua/box_error.rst @@ -275,6 +275,9 @@ Below is a list of ``box.error`` functions and related objects. * - :doc:`./box_error/set` - Set the specified error as the last system error explicitly + + * - :doc:`./box_error/is` + - Verify whether the specified argument is an error * - :doc:`./box_error/error_object` - An object that defines an error @@ -288,4 +291,5 @@ Below is a list of ``box.error`` functions and related objects. box_error/clear box_error/new box_error/set + box_error/is box_error/error_object diff --git a/doc/reference/reference_lua/box_error/is.rst b/doc/reference/reference_lua/box_error/is.rst new file mode 100644 index 0000000000..ec51cf08e5 --- /dev/null +++ b/doc/reference/reference_lua/box_error/is.rst @@ -0,0 +1,28 @@ +.. _box_error-is: + +=============================================================================== +box.error.is() +=============================================================================== + +.. function:: box.error.is(object_name) + + **Since:** :doc:`3.2.0 ` + + The ``box.error.is`` function allows verify whether the specified argument is an error. + + :param object_name object_name: the subject of the request + + **Return type:** + boolean + + **Example** + + .. code-block:: lua + tarantool> box.error.is(box.error.new(box.error.UNKNOWN)) + --- + - true + ... + tarantool> box.error.is('foo') + --- + - false + ... \ No newline at end of file From 672164461ff9b857bedd65a7b45ac1aa30419c0c Mon Sep 17 00:00:00 2001 From: "a.ardeev" Date: Wed, 14 May 2025 18:06:19 +0300 Subject: [PATCH 3/4] Update by comments Fix comments recieved from SME --- doc/reference/reference_lua/box_error.rst | 2 +- .../reference_lua/box_error/error_object.rst | 2 +- doc/reference/reference_lua/box_error/is.rst | 25 ++++++++++--------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/doc/reference/reference_lua/box_error.rst b/doc/reference/reference_lua/box_error.rst index 38cca8fe26..abbc5733b5 100644 --- a/doc/reference/reference_lua/box_error.rst +++ b/doc/reference/reference_lua/box_error.rst @@ -277,7 +277,7 @@ Below is a list of ``box.error`` functions and related objects. - Set the specified error as the last system error explicitly * - :doc:`./box_error/is` - - Verify whether the specified argument is an error + - Verify whether the specified argument is an error cdata object * - :doc:`./box_error/error_object` - An object that defines an error diff --git a/doc/reference/reference_lua/box_error/error_object.rst b/doc/reference/reference_lua/box_error/error_object.rst index 47b665ef21..b2d151290a 100644 --- a/doc/reference/reference_lua/box_error/error_object.rst +++ b/doc/reference/reference_lua/box_error/error_object.rst @@ -196,6 +196,6 @@ error_object **Since:** :doc:`3.1.0 ` - Returns the name of the error used at creation. + Returns the name of the error. diff --git a/doc/reference/reference_lua/box_error/is.rst b/doc/reference/reference_lua/box_error/is.rst index ec51cf08e5..0cb5846e38 100644 --- a/doc/reference/reference_lua/box_error/is.rst +++ b/doc/reference/reference_lua/box_error/is.rst @@ -4,25 +4,26 @@ box.error.is() =============================================================================== -.. function:: box.error.is(object_name) +.. function:: box.error.is(object) **Since:** :doc:`3.2.0 ` - The ``box.error.is`` function allows verify whether the specified argument is an error. + The ``box.error.is`` function allows verify whether the specified argument is an error cdata object. - :param object_name object_name: the subject of the request + :param object object: the name of the othe object to be verified. **Return type:** boolean **Example** - .. code-block:: lua - tarantool> box.error.is(box.error.new(box.error.UNKNOWN)) - --- - - true - ... - tarantool> box.error.is('foo') - --- - - false - ... \ No newline at end of file + .. code-block:: lua + + tarantool> box.error.is(box.error.new(box.error.UNKNOWN)) + --- + - true + ... + tarantool> box.error.is('foo') + --- + - false + ... \ No newline at end of file From cddd939f2223fb6f3199bdac88eee10f759e1eb9 Mon Sep 17 00:00:00 2001 From: "a.ardeev" Date: Thu, 15 May 2025 16:06:11 +0300 Subject: [PATCH 4/4] Fix by comment and fix typo --- doc/reference/reference_lua/box_error/is.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/reference/reference_lua/box_error/is.rst b/doc/reference/reference_lua/box_error/is.rst index 0cb5846e38..6d0f2a62d9 100644 --- a/doc/reference/reference_lua/box_error/is.rst +++ b/doc/reference/reference_lua/box_error/is.rst @@ -10,7 +10,7 @@ box.error.is() The ``box.error.is`` function allows verify whether the specified argument is an error cdata object. - :param object object: the name of the othe object to be verified. + :param object object: the object to be verified. **Return type:** boolean