From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 85DF627AC3 for ; Sat, 1 Dec 2018 19:27:38 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4t3RkQBozD0F for ; Sat, 1 Dec 2018 19:27:38 -0500 (EST) Received: from smtp37.i.mail.ru (smtp37.i.mail.ru [94.100.177.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id C21D427A6E for ; Sat, 1 Dec 2018 19:27:37 -0500 (EST) From: Roman Khabibov Subject: [tarantool-patches] [PATCH] lua: modify the error message in 'fio.pathjoin' Date: Sun, 2 Dec 2018 03:27:29 +0300 Message-Id: <20181202002729.8968-1-roman.habibov@tarantool.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: v.shpilevoy@tarantool.org Display line number with error and fix the bug with bad argument number. Closes #3580 Branch: https://github.com/tarantool/tarantool/tree/romanhabibov/gh-3580-err-msg-pathjoin Issue: https://github.com/tarantool/tarantool/issues/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..13a4d36dc 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("in function '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("in function 'pathjoin' undefined path part "..i, 2) end sp = tostring(sp) diff --git a/test/app/fio.result b/test/app/fio.result index b7a1f65c6..fd3e289c4 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: in function 'pathjoin' undefined path part 1 +... +fio.pathjoin('abc', nil) +--- +- error: in function 'pathjoin' undefined path part 2 +... +fio.pathjoin('abc', 'cde', nil) +--- +- error: in function '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