aboutsummaryrefslogtreecommitdiff
path: root/src/lpm.lua
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2023-11-30 15:16:54 -0500
committerAdam Harrison <adamdharrison@gmail.com>2023-11-30 15:16:54 -0500
commit7328ad929bab08778b1e4c9c82c0e20934f62510 (patch)
tree4ae52ecd7d4cc11dc888679cbd1638edcdbaa2f8 /src/lpm.lua
parenta64713cef556f994e9db95c2b23e4059917e3219 (diff)
downloadlite-xl-plugin-manager-7328ad929bab08778b1e4c9c82c0e20934f62510.tar.gz
lite-xl-plugin-manager-7328ad929bab08778b1e4c9c82c0e20934f62510.zip
Added in better error handling.
Diffstat (limited to 'src/lpm.lua')
-rw-r--r--src/lpm.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lpm.lua b/src/lpm.lua
index 23ad06d..e122fe9 100644
--- a/src/lpm.lua
+++ b/src/lpm.lua
@@ -464,7 +464,7 @@ function common.chdir(dir, callback)
system.chdir(dir)
local status, err = pcall(callback)
system.chdir(wd)
- if not status then error(err) end
+ if not status then error(err, 0) end
end
function common.stat(path)
local stat = system.stat(path)
@@ -536,7 +536,8 @@ end
local status = 0
local function error_handler(err)
- local s, e = err and err:find(":%d+")
+ local s, e
+ if err then s, e = err:find("%:%d+") end
local message = e and err:sub(e + 3) or err
if JSON then
if VERBOSE then
@@ -892,7 +893,7 @@ function Addon:install(bottle, installing)
bottle:invalidate_cache()
if not status then
common.rmrf(temporary_install_path)
- error(err)
+ error(err, 0)
elseif self.type ~= "meta" then
if POST and self.post then
common.chdir(temporary_install_path, function()
@@ -1202,7 +1203,7 @@ function Repository:fetch()
local dir = common.dirname(path)
if system.stat(dir) and #system.ls(dir) == 0 then common.rmrf(dir) end
end
- error(err)
+ error(err, 0)
end
return self
end