Tarantool development patches archive
 help / color / mirror / Atom feed
From: Roman Khabibov <roman.habibov@tarantool.org>
To: tarantool-patches@freelists.org
Cc: vdavydov.dev@gmail.com
Subject: [PATCH 1/2 v2] lua: modify the error message in 'fio.pathjoin'
Date: Tue,  4 Dec 2018 19:00:37 +0300	[thread overview]
Message-ID: <dce03b75a6fec2a592d9daf820e8b985f513d86a.1543938959.git.roman.habibov@tarantool.org> (raw)
In-Reply-To: <cover.1543938959.git.roman.habibov@tarantool.org>

Display line number with error and fix the bug with bad argument number.

Closes #3580
---
 src/lua/fio.lua       |  4 ++--
 test/app/fio.result   | 13 +++++++++++++
 test/app/fio.test.lua |  5 +++++
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/lua/fio.lua b/src/lua/fio.lua
index 55faebdcb..1d0bb4bd1 100644
--- a/src/lua/fio.lua
+++ b/src/lua/fio.lua
@@ -213,7 +213,7 @@ fio.pathjoin = function(...)
     while i <= len do
         local sp = select(i, ...)
         if sp == nil then
-            error("Undefined path part "..i)
+            error("fio.pathjoin() undefined path part "..i, 2)
         end
 
         sp = tostring(sp)
@@ -233,7 +233,7 @@ fio.pathjoin = function(...)
     while i <= len do
         local sp = select(i, ...)
         if sp == nil then
-            error("Undefined path part")
+            error("fio.pathjoin() undefined path part "..i, 2)
         end
 
         sp = tostring(sp)
diff --git a/test/app/fio.result b/test/app/fio.result
index b7a1f65c6..9777a0aec 100644
--- a/test/app/fio.result
+++ b/test/app/fio.result
@@ -55,6 +55,19 @@ fio.pathjoin('abc', 'awdeq///qweqwqwe///', "//asda//")
 ---
 - abc/awdeq/qweqwqwe/asda
 ...
+--gh-3580 Modify the error message in 'fio.pathjoin'.
+fio.pathjoin(nil)
+---
+- error: fio.pathjoin() undefined path part 1
+...
+fio.pathjoin('abc', nil)
+---
+- error: fio.pathjoin() undefined path part 2
+...
+fio.pathjoin('abc', 'cde', nil)
+---
+- error: fio.pathjoin() undefined path part 3
+...
 -- basename
 st, err = pcall(fio.basename, nil)
 ---
diff --git a/test/app/fio.test.lua b/test/app/fio.test.lua
index 4f34fd11c..b6c79648c 100644
--- a/test/app/fio.test.lua
+++ b/test/app/fio.test.lua
@@ -18,6 +18,11 @@ fio.pathjoin('/', '/cde')
 fio.pathjoin('/a', '/')
 fio.pathjoin('abc', 'awdeq///qweqwqwe///', "//asda//")
 
+--gh-3580 Modify the error message in 'fio.pathjoin'.
+fio.pathjoin(nil)
+fio.pathjoin('abc', nil)
+fio.pathjoin('abc', 'cde', nil)
+
 -- basename
 st, err = pcall(fio.basename, nil)
 st
-- 
2.19.1

  reply	other threads:[~2018-12-04 16:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-04 16:00 [PATCH 0/2 v2] fio: show function name in all fio errors Roman Khabibov
2018-12-04 16:00 ` Roman Khabibov [this message]
2018-12-04 16:00 ` [PATCH 2/2 " Roman Khabibov
2018-12-04 16:12 ` [PATCH 0/2 " Vladimir Davydov
2018-12-07  7:25   ` Alexander Turenko
2018-12-08 13:41     ` [tarantool-patches] " roman
2018-12-08 14:36       ` Alexander Turenko
2018-12-08 15:02         ` roman
2018-12-08 15:12           ` Alexander Turenko
2018-12-09  9:36       ` Vladimir Davydov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dce03b75a6fec2a592d9daf820e8b985f513d86a.1543938959.git.roman.habibov@tarantool.org \
    --to=roman.habibov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [PATCH 1/2 v2] lua: modify the error message in '\''fio.pathjoin'\''' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox