Skip to content

Commit 3a8c9d2

Browse files
committed
refactor: move ERROR_MESSAGE closer to where it's used
1 parent 5f383ae commit 3a8c9d2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/luarocks/build/lls-addon.lua

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ local unnest2 = tableUtil.unnest2
1313
local DIR_SEP = string.sub(package.config, 1, 1)
1414
local PATH_SEP = string.sub(package.config, 3, 3)
1515
local PATH_SEP_PATTERN = "[^%" .. PATH_SEP .. "]+"
16-
local ERROR_MESSAGE = [[
17-
An error occurred while running the lls-addon backend.
18-
Please file an issue at https://github.com/LuaLS/luarocks-build-addon/issues
19-
%s]]
2016

2117
local M = {}
2218

@@ -375,6 +371,11 @@ local function installAddon(rockspec, env, noInstall)
375371
end
376372
M.installAddon = installAddon
377373

374+
local CRASH_MESSAGE = [[
375+
An error occurred while running the lls-addon backend.
376+
Please file an issue at https://github.com/LuaLS/luarocks-build-addon/issues
377+
]]
378+
378379
---@param rockspec luarocks.rockspec
379380
---@param noInstall boolean
380381
---@return boolean, string?
@@ -395,7 +396,7 @@ function M.run(rockspec, noInstall)
395396
return false, match
396397
else
397398
-- luacov: disable
398-
error(string.format(ERROR_MESSAGE, msg))
399+
error(CRASH_MESSAGE .. msg)
399400
-- luacov: enable
400401
end
401402
end

0 commit comments

Comments
 (0)