From: Petr Špaček Date: Mon, 30 Dec 2019 15:56:11 +0000 (+0100) Subject: utils: add human-readable text to HTTP client library errors X-Git-Tag: v5.0.0~13^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ddfdb3e7b9ba08233d21355b47bc81a205d55007;p=thirdparty%2Fknot-resolver.git utils: add human-readable text to HTTP client library errors --- 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