Skip to content

Commit 212b884

Browse files
committed
simplify
1 parent ab5d005 commit 212b884

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

lua/CopilotChat/client.lua

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,19 +253,14 @@ function Client:models()
253253
local ok, headers = pcall(self.authenticate, self, provider_name)
254254
if not ok then
255255
log.error('Failed to authenticate with ' .. provider_name .. ': ' .. headers)
256-
local user_err_msg = 'Failed to authenticate with ' .. provider_name
257-
-- append error details, if available
258-
local headers_json = utils.json_decode(headers)
259-
if headers_json.error_details and headers_json.error_details.message then
260-
user_err_msg = user_err_msg .. ' the server replied : ' .. headers_json.error_details.message
261-
end
262-
error(user_err_msg)
256+
error(headers)
263257
return {}
264258
end
265259

266260
local ok, models = pcall(provider.get_models, headers)
267261
if not ok then
268262
log.warn('Failed to fetch models from ' .. provider_name .. ': ' .. models)
263+
error(models)
269264
return {}
270265
end
271266

0 commit comments

Comments
 (0)