diff options
-rwxr-xr-x | prosody | 2 | ||||
-rwxr-xr-x | prosodyctl | 8 | ||||
-rw-r--r-- | util/datamanager.lua | 2 |
3 files changed, 8 insertions, 4 deletions
@@ -303,7 +303,7 @@ end function loop() -- Error handler for errors that make it this far local function catch_uncaught_error(err) - if type(err) == "string" and err:match("%d*: interrupted!$") then + if type(err) == "string" and err:match("interrupted!$") then return "quitting"; end @@ -462,14 +462,18 @@ function commands.unregister(arg) return 1; end +local http_errors = { + [404] = "Plugin not found, did you type the address correctly?" + }; + function commands.addplugin(arg) local url = arg[1]; if url:match("^http://") then local http = require "socket.http"; show_message("Fetching..."); local code, err = http.request(url); - if not code then - show_message("Failed: "..err); + if not code or not tostring(err):match("^[23]") then + show_message("Failed: "..(http_errors[err] or ("HTTP error "..err))); return 1; end if url:match("%.lua$") then diff --git a/util/datamanager.lua b/util/datamanager.lua index bfd69ebf..30cd082b 100644 --- a/util/datamanager.lua +++ b/util/datamanager.lua @@ -88,7 +88,7 @@ end function getpath(username, host, datastore, ext, create) ext = ext or "dat"; - host = host and encode(host); + host = (host and encode(host)) or "_global"; username = username and encode(username); if username then if create then mkdir(mkdir(mkdir(data_path).."/"..host).."/"..datastore); end |