Skip to content

error: update current documentation #1676

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

Closed
Tracked by #2960
LeonidVas opened this issue Dec 5, 2020 · 0 comments · Fixed by #3618
Closed
Tracked by #2960

error: update current documentation #1676

LeonidVas opened this issue Dec 5, 2020 · 0 comments · Fixed by #3618
Assignees
Labels
add details [nature] More details needed, some info missing. Documentation is incomplete. errors example Problem with a code example. reference [location] Tarantool manual, Reference part

Comments

@LeonidVas
Copy link

LeonidVas commented Dec 5, 2020

I will try to describe what confuses me and what I suggest to improve.
It's look like the old (before 2.4) and new (after 2.4) descriptions have been squashed with out of a synchronization.

Proposed changes:

  1. About description of error before 2.4:
  • box.error(code, errtext[, errtext ...]) has two description. I propose squash to one.
  • about code in case of using box.error () - it would be nice to add information that code will determine the format of the error message.
  1. About description of error after 2.4:
  • In the old description of creating an error (box.error () and box.error {}) is need to add a way to create CustomError with a link to the detailed description.
  • when type is added to the arguments for box.error () and box.error {}, add a detailed description: "What does this mean" (or a link to a detailed description).
  1. Add :unpack() example for every type of generated error:
  • ClientError:
tarantool> box.error.new(10, "Space"):unpack()
---
- code: 10
  base_type: ClientError
  type: ClientError
  message: Space 'Space' already exists
  trace:
  - file: '[string "return box.error.new(10, "Space"):unpack()"]'
    line: 1
...
tarantool> box.error.new{ code = 10, reason = "Message" }:unpack()
---
- code: 10
  base_type: ClientError
  type: ClientError
  message: Message
  trace:
  - file: '[string "return box.error.new{code = 10, reason = "Mes..."]'
    line: 1
  • CustomError
tarantool> box.error.new("MyType", "Message: %s", "msg"):unpack()
---
- code: 0
  base_type: CustomError
  type: MyType
  custom_type: MyType
  message: 'Message: msg'
  trace:
  - file: '[string "return box.error.new("MyType", "Message: %s",..."]'
    line: 1
...
tarantool> box.error.new{ code  =  10, type  =  "MyType", reason = "Message" }:unpack()
---
- code: 10
  base_type: CustomError
  type: MyType
  custom_type: MyType
  message: Message
  trace:
  - file: '[string "return box.error.new{code = 10, type = "MyTyp..."]'
    line: 1
...
  1. Add description of error transmission through netbox (before and after 2.4)
  • when an error thrown (IPROTO_ERROR is used)

old (all errors will be converted to ClientError):

tarantool> res, err = pcall(con.call, con, 'box.ctl.wait_ro', {0.001})
---
...

tarantool> err:unpack()
---
- type: ClientError
  code: 115
  message: timed out
  trace:
  - file: builtin/box/net_box.lua
    line: 263
...

new (an error will be transmitted as is):

tarantool> ok, err = pcall(con.call, con, 'box.ctl.wait_ro', {0.001})
---
...

tarantool> err:unpack()
---
- errno: 110
  base_type: TimedOut
  type: TimedOut
  message: timed out
  trace:
  - file: /build/tarantool-2.5.2.11/src/lib/core/fiber_cond.c
    line: 108
...
  • when an error transmitted as an object, like return box.error.new() (IPROTO OK is used)
tarantool> function test_error() return box.error.new { code = 3 , reason = "Some reason" } end

old (all errors will be converted to string(error message)):

tarantool> err = con:call('test_error')
---
...

tarantool> type(err)
---
- string
...

tarantool> err
---
- Some reason
...

new (the transparent marshaling can be enabled):

tarantool> con.space._session_settings:update('error_marshaling_enabled', {{'=', 2, true}})
---
- ['error_marshaling_enabled', true]
...

tarantool> err = con:call('test_error')
---
...

tarantool> type(err)
---
- cdata
...

tarantool> err:unpack()
---
- code: 3
  base_type: ClientError
  type: ClientError
  message: Some reason
  trace:
  - file: '[C]'
    line: 4294967295
...
@Onvember Onvember self-assigned this Dec 7, 2020
@Onvember Onvember changed the title error: update current documentation [12pt] error: update current documentation Dec 7, 2020
@Onvember Onvember added 1.10 add details [nature] More details needed, some info missing. Documentation is incomplete. reference [location] Tarantool manual, Reference part labels Dec 7, 2020
@NickVolynkin NickVolynkin changed the title [12pt] error: update current documentation [5pt] error: update current documentation Mar 25, 2021
@veod32 veod32 added 2.4 and removed 1.10 labels Jun 11, 2021
@veod32 veod32 added this to the error milestone Dec 29, 2021
@patiencedaur patiencedaur added the example Problem with a code example. label Feb 28, 2022
@patiencedaur patiencedaur removed the 2.4 label Apr 18, 2022
@veod32 veod32 added errors and removed 5sp labels Mar 1, 2023
@veod32 veod32 removed this from the error milestone Mar 1, 2023
@veod32 veod32 changed the title [5pt] error: update current documentation error: update current documentation Mar 1, 2023
@andreyaksenov andreyaksenov self-assigned this Aug 15, 2023
@andreyaksenov andreyaksenov linked a pull request Aug 16, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add details [nature] More details needed, some info missing. Documentation is incomplete. errors example Problem with a code example. reference [location] Tarantool manual, Reference part
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants