From ddfdb3e7b9ba08233d21355b47bc81a205d55007 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Petr=20=C5=A0pa=C4=8Dek?= Date: Mon, 30 Dec 2019 16:56:11 +0100 Subject: [PATCH] utils: add human-readable text to HTTP client library errors --- daemon/lua/kluautil.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/daemon/lua/kluautil.lua b/daemon/lua/kluautil.lua index d0cca438f..fa9620269 100644 --- a/daemon/lua/kluautil.lua +++ b/daemon/lua/kluautil.lua @@ -1,3 +1,4 @@ +local cqerrno = require('cqueues.errno') local kluautil = {} -- Get length of table @@ -39,6 +40,10 @@ function kluautil.kr_https_fetch(url, out_file, ca_file) local headers, stream, errmsg = req:go() if not headers then errmsg = errmsg or 'unknown error' + if type(errmsg) == 'number' then + errmsg = cqerrno.strerror(errmsg) .. + ' (' .. tostring(errmsg) .. ')' + end return nil, 'HTTP client library error: ' .. errmsg end if headers:get(':status') ~= "200" then -- 2.47.2