Skip to content

Add name parameter and box.error.is function description to box.error. #5112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: latest
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/reference/reference_lua/box_error.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 cdata object

* - :doc:`./box_error/error_object`
- An object that defines an error
Expand All @@ -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
10 changes: 10 additions & 0 deletions doc/reference/reference_lua/box_error/error_object.rst
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,13 @@ error_object

For the ``box.error.READONLY`` error, returns the current election term (see :ref:`box.info.election.term <box_info_election>`).
This attribute may present if the :ref:`error reason <box_error-reason>` is ``election`` or ``synchro``.

.. _box_error-name:

.. data:: name

**Since:** :doc:`3.1.0 </release/3.1.0>`

Returns the name of the error.


29 changes: 29 additions & 0 deletions doc/reference/reference_lua/box_error/is.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.. _box_error-is:

===============================================================================
box.error.is()
===============================================================================

.. function:: box.error.is(object)

**Since:** :doc:`3.2.0 </release/3.2.0>`

The ``box.error.is`` function allows verify whether the specified argument is an error cdata object.

:param object object: the 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
...