Skip to content

Commit 1e5cf7c

Browse files
authored
fix(gitlab): Better error logs for gitlab config sync (#692)
1 parent 84e53c8 commit 1e5cf7c

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Changed
1111
- Bake Sourcebot version into code rather than relying on build arg. [#680](https://github.com/sourcebot-dev/sourcebot/pull/680)
1212
- Fix issue with `/repos` page pagination. [#689](https://github.com/sourcebot-dev/sourcebot/pull/689)
13+
- Add better logs for gitlab config sync fails. [#692](https://github.com/sourcebot-dev/sourcebot/pull/692)
1314

1415
## [4.10.4] - 2025-12-18
1516

packages/backend/src/gitlab.ts

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,16 @@ export const getGitLabReposFromConfig = async (config: GitlabConnectionConfig) =
9797
logger.error(`Failed to fetch projects for group ${group}.`, e);
9898

9999
const status = e?.cause?.response?.status;
100-
if (status === 404) {
101-
const warning = `Group ${group} not found or no access`;
102-
logger.warn(warning);
100+
if (status !== undefined) {
101+
const warning = `GitLab API returned ${status}`
102+
logger.warning(warning);
103103
return {
104104
type: 'warning' as const,
105105
warning
106-
};
106+
}
107107
}
108+
109+
logger.error("No API response status returned");
108110
throw e;
109111
}
110112
}));
@@ -135,14 +137,16 @@ export const getGitLabReposFromConfig = async (config: GitlabConnectionConfig) =
135137
logger.error(`Failed to fetch projects for user ${user}.`, e);
136138

137139
const status = e?.cause?.response?.status;
138-
if (status === 404) {
139-
const warning = `User ${user} not found or no access`;
140-
logger.warn(warning);
140+
if (status !== undefined) {
141+
const warning = `GitLab API returned ${status}`
142+
logger.warning(warning);
141143
return {
142144
type: 'warning' as const,
143145
warning
144-
};
146+
}
145147
}
148+
149+
logger.error("No API response status returned");
146150
throw e;
147151
}
148152
}));
@@ -171,15 +175,16 @@ export const getGitLabReposFromConfig = async (config: GitlabConnectionConfig) =
171175
logger.error(`Failed to fetch project ${project}.`, e);
172176

173177
const status = e?.cause?.response?.status;
174-
175-
if (status === 404) {
176-
const warning = `Project ${project} not found or no access`;
177-
logger.warn(warning);
178+
if (status !== undefined) {
179+
const warning = `GitLab API returned ${status}`
180+
logger.warning(warning);
178181
return {
179182
type: 'warning' as const,
180183
warning
181-
};
184+
}
182185
}
186+
187+
logger.error("No API response status returned");
183188
throw e;
184189
}
185190
}));

0 commit comments

Comments
 (0)