Skip to content

Commit 2279dbe

Browse files
authored
fix(provider): safely call curl.post for model policy (#1419)
Wrap curl.post in pcall to prevent errors when enabling model policy. This avoids potential crashes if the request fails.
1 parent 1bbe034 commit 2279dbe

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lua/CopilotChat/config/providers.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ M.copilot = {
333333

334334
for _, model in ipairs(models) do
335335
if not model.policy then
336-
curl.post('https://api.githubcopilot.com/models/' .. model.id .. '/policy', {
336+
pcall(curl.post, 'https://api.githubcopilot.com/models/' .. model.id .. '/policy', {
337337
headers = headers,
338338
json_request = true,
339339
body = { state = 'enabled' },

0 commit comments

Comments
 (0)