Skip to content
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

Lua API to create box.error() objects without throwing them #3031

Closed
rtsisyk opened this issue Jan 10, 2018 · 2 comments
Closed

Lua API to create box.error() objects without throwing them #3031

rtsisyk opened this issue Jan 10, 2018 · 2 comments
Assignees
Labels
feature A new functionality good first issue Good for newcomers

Comments

@rtsisyk
Copy link
Contributor

rtsisyk commented Jan 10, 2018

Current it is not possible to create box.error() (struct error) objects without throwing them. Let's bind box_error_new() C API to Lua.

@rtsisyk rtsisyk added the feature A new functionality label Jan 10, 2018
@rtsisyk rtsisyk added this to the wishlist milestone Jan 10, 2018
@kostja kostja added good first issue Good for newcomers and removed feature A new functionality labels Feb 7, 2018
@Gerold103 Gerold103 self-assigned this Apr 12, 2018
@Gerold103 Gerold103 added the feature A new functionality label Apr 12, 2018
@Gerold103
Copy link
Collaborator

@TarantoolBot document
Title: box.error.new() - create an error object with no throw
box.error.new(error_code, args) - the way to create an error object and do not throw it, but just return as the simple object. It is useful when an error object must be saved to be got later, for example.

tarantool> e = box.error.new(box.error.CREATE_SPACE, "space", "error")
tarantool> e
---
- 'Failed to create space ''space'': error'
...
tarantool> e:unpack()
---
- type: ClientError
  code: 9
  message: 'Failed to create space ''space'': error'
  trace:
  - file: '[string "e = box.error.new(box.error.CREATE_SPACE, "sp..."]'
    line: 1
...

@TarantoolBot
Copy link
Collaborator

@Gerold103: Accept.

Gerold103 added a commit that referenced this issue Apr 12, 2018
It is needed to return error via 'nil, error_object' notation,
and to store an error object to return it later.

Closes #3031
Gerold103 added a commit that referenced this issue Apr 16, 2018
It is needed to return error via 'nil, error_object' notation,
and to store an error object to return it later.

Closes #3031
Gerold103 added a commit that referenced this issue May 8, 2018
It is needed to return error via 'nil, error_object' notation,
and to store an error object to return it later.

Closes #3031
Gerold103 added a commit that referenced this issue May 8, 2018
It is needed to return error via 'nil, error_object' notation,
and to store an error object to return it later.

Closes #3031
@kostja kostja removed this from the wishlist milestone May 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new functionality good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants