Capture and surface GitLab API response bodies on errors#30
Merged
Conversation
Every GitLab API call in GitLabService now goes through a shared assertOk helper that reads the response body, logs it to the extension host log, and throws a typed GitLabApiError carrying status, statusText, url, method, and body. Without this, opaque HTTP statusText was the only diagnostic available. The new error class lets codex-editor's sync toast surface a copyable error report to support staff.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Capture and surface GitLab API response bodies on errors.
GitLab API failures previously bubbled up as opaque "Forbidden" / "Unauthorized" status text, with no way to see the actual reason (expired password, missing scope, etc.). This change introduces a structured
GitLabApiErrorthat carries the response body, URL, method, and operation label, plus a centralizedassertOkhelper that logs the full body to the extension host log. Pairs with codex-editor's "Copy Error Details" toast — both should ship together so users can paste the body to support.New log message shows actual error:

Changes
GitLabApiErrorinsrc/utils/apiError.tswith status/url/method/body fieldsassertOkprivate helper inGitLabServicethat logs and throws on non-OK responses!response.okerror-throw blocks across 8 callsites withassertOkTest plan
GitLabApiErrorcarriesstatus,url,method,bodyaccessible to callersgetRepositoryFilestill throws "File not found: "getRepositoryTreereturns[]on 404 unchanged