Merge pull request #525 from jakubbortlik/fix/revert-removing-on_error_callback

fix: revert removing on_error_callback
This commit is contained in:
Harrison (Harry) Cramer
2026-03-17 20:34:06 -04:00
committed by GitHub

View File

@@ -4,7 +4,7 @@ local Job = require("plenary.job")
local u = require("gitlab.utils")
local M = {}
M.run_job = function(endpoint, method, body, callback)
M.run_job = function(endpoint, method, body, callback, on_error_callback)
local state = require("gitlab.state")
local args = { "-s", "-X", (method or "POST"), string.format("localhost:%s", state.settings.port) .. endpoint }
@@ -16,7 +16,8 @@ M.run_job = function(endpoint, method, body, callback)
-- This handler will handle all responses from the Go server. Anything with a successful
-- status will call the callback (if it is supplied for the job). Otherwise, it will print out the
-- success message or error message and details from the Go server.
-- success message or error message and details from the Go server and run the on_error_callback
-- (if supplied for the job).
local stderr = {}
Job:new({
command = "curl",
@@ -53,6 +54,9 @@ M.run_job = function(endpoint, method, body, callback)
-- Handle error case
local message = string.format("%s: %s", data.message, data.details)
u.notify(message, vim.log.levels.ERROR)
if on_error_callback then
on_error_callback(data)
end
end
end, 0)
end,