diff --git a/scripts/wx_download.lua b/scripts/wx_download.lua index 560dab8..f2c1bd2 100644 --- a/scripts/wx_download.lua +++ b/scripts/wx_download.lua @@ -39,12 +39,16 @@ local function get_access_token() ngx.say(pl.write(resp_err)) ngx.exit(resp.status) else - ngx.log(ngx.ERR, "RESP IS OK -> ", pl.write(resp.body)) + ngx.log(ngx.ERR, "RESP IS OK -> ", pl.write(resp.body)) return cjson.decode(resp.body).d end else - ngx.log(ngx.ERR, "FAILED TO CONNECT TO *HTYUC* RESP STATUS ->", resp.status) - ngx.exit(resp.status) + if resp == nil then + resp = "" + end + ngx.log(ngx.ERR, "FAILED TO CONNECT TO *HTYUC*: httpc throws runtime error, please check HTYUC log. / ", pl.write(resp)) + ngx.say(pl.write(resp)) + ngx.exit(401) end end