Skip to content
Snippets Groups Projects
Commit 405bfe40 authored by Ilya Verbin's avatar Ilya Verbin Committed by Vladimir Davydov
Browse files

console: handle internal.format_yaml exceptions

Currently the call to internal.format_yaml in output_handlers["yaml"]
is covered by pcall only for `status == true`, however the opposite
case also can raise an exception. This patch adds the missed exception
handling. Two distinct calls are required, because it is not possible to
assing variadic arguments (...) to a variable if some of them is nil.
If the first call fails, internal.format_yaml will be called for the
second time. Hopefully, it will not fail during formatting of the error
message received from libyaml.

Before:
```
tarantool> require('net.box').self:call('\x80')
LuajitError: builtin/box/console.lua:710: expected SCALAR, SEQUENCE-START,
    MAPPING-START, or ALIAS fatal error, exiting the event loop
~/test$ echo $?
0
~/test$
```

After:
```
tarantool> require('net.box').self:call('\x80')
---
- error: 'console: an exception occurred when formatting the output:
    expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS'
...

tarantool>
```

Part of #6781
Part of #6934

NO_DOC=bugfix
NO_TEST=see later commits
NO_CHANGELOG=see later commits
parent c84cdc73
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment