File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -101,14 +101,29 @@ function utils.handle_res(out)
101
101
msg = " curl failed" ,
102
102
}
103
103
elseif out .status >= 300 then
104
+ local ok , msg = pcall (function ()
105
+ local dec = utils .decode (out .body )
106
+
107
+ if dec .error then return dec .error end
108
+
109
+ local tbl = {}
110
+ for _ , e in ipairs (dec .errors ) do
111
+ table.insert (tbl , e .message )
112
+ end
113
+
114
+ return table.concat (tbl , " \n " )
115
+ end )
116
+
104
117
res = out .body
105
118
err = {
106
119
code = 0 ,
107
120
status = out .status ,
108
121
response = out ,
109
- msg = " http error " .. out .status ,
122
+ msg = " http error " .. out .status .. ( ok and ( " \n\n " .. msg ) or " " ) ,
110
123
out = out .body ,
111
124
}
125
+
126
+ log .info (err )
112
127
else
113
128
res = utils .decode (out .body )
114
129
end
You can’t perform that action at this time.
0 commit comments