Skip to content

Commit 59d1a4c

Browse files
committed
better logs for gitlab config sync
1 parent 84e53c8 commit 59d1a4c

File tree

1 file changed

+12
-22
lines changed

1 file changed

+12
-22
lines changed

packages/backend/src/gitlab.ts

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,10 @@ 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);
103-
return {
104-
type: 'warning' as const,
105-
warning
106-
};
100+
if (status !== undefined) {
101+
logger.error(`HTTP status: ${status}`);
102+
} else {
103+
logger.error(`HTTP status: undefined`);
107104
}
108105
throw e;
109106
}
@@ -135,13 +132,10 @@ export const getGitLabReposFromConfig = async (config: GitlabConnectionConfig) =
135132
logger.error(`Failed to fetch projects for user ${user}.`, e);
136133

137134
const status = e?.cause?.response?.status;
138-
if (status === 404) {
139-
const warning = `User ${user} not found or no access`;
140-
logger.warn(warning);
141-
return {
142-
type: 'warning' as const,
143-
warning
144-
};
135+
if (status !== undefined) {
136+
logger.error(`HTTP status: ${status}`);
137+
} else {
138+
logger.error(`HTTP status: undefined`);
145139
}
146140
throw e;
147141
}
@@ -171,14 +165,10 @@ export const getGitLabReposFromConfig = async (config: GitlabConnectionConfig) =
171165
logger.error(`Failed to fetch project ${project}.`, e);
172166

173167
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-
return {
179-
type: 'warning' as const,
180-
warning
181-
};
168+
if (status !== undefined) {
169+
logger.error(`HTTP status: ${status}`);
170+
} else {
171+
logger.error(`HTTP status: undefined`);
182172
}
183173
throw e;
184174
}

0 commit comments

Comments
 (0)