Commit e6a2093
Add error handling at the server instance
When executing the following code on the remote server instance using
`server:exec()`, we could get an unobvious error:
s = Server:new()
s:start()
-- we expected a custom error with the "My error" message, but
-- got "Transaction is active at return from function"
s:exec(function() box.begin() error("My error") end)
This is due to the specific evaluation and capture of the return values
of `net_box:eval` (for more details see here: tarantool/tarantool#7288).
The error will be raised on the server instance side. In the process of
development we found that our approach does not work in the specific
case:
-- an error message has been expected but got an error table:
-- {
-- class = LuatestError,
-- status = fail,
-- message = "a value evaluating to true, actual: false"
-- }
s:exec(function() require('luatest').assert(false) end)
To fix this error we decided to add the encoding an error to JSON format
on the server and decode it on the client side.
Close #242
Co-authored-by: Yaroslav Lobankov <y.lobankov@tarantool.org>1 parent 78220f8 commit e6a2093
2 files changed
+67
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
522 | 522 | | |
523 | 523 | | |
524 | 524 | | |
525 | | - | |
| 525 | + | |
| 526 | + | |
526 | 527 | | |
527 | 528 | | |
528 | 529 | | |
| |||
604 | 605 | | |
605 | 606 | | |
606 | 607 | | |
607 | | - | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
608 | 616 | | |
609 | 617 | | |
610 | 618 | | |
| |||
613 | 621 | | |
614 | 622 | | |
615 | 623 | | |
| 624 | + | |
616 | 625 | | |
617 | | - | |
| 626 | + | |
618 | 627 | | |
619 | | - | |
| 628 | + | |
620 | 629 | | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
621 | 637 | | |
622 | 638 | | |
623 | 639 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
0 commit comments