Skip to content

Commit f81bd3b

Browse files
committed
return warning object correctly
1 parent 51424b3 commit f81bd3b

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

packages/backend/src/gitlab.ts

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,15 @@ export const getGitLabReposFromConfig = async (config: GitlabConnectionConfig) =
9898

9999
const status = e?.cause?.response?.status;
100100
if (status !== undefined) {
101-
logger.error(`HTTP status: ${status}`);
102-
} else {
103-
logger.error(`HTTP status: undefined`);
101+
const warning = `GitLab API returned ${status}`
102+
logger.warning(warning);
103+
return {
104+
type: 'warning' as const,
105+
warning
106+
}
104107
}
108+
109+
logger.error("No API response status returned");
105110
throw e;
106111
}
107112
}));
@@ -133,10 +138,15 @@ export const getGitLabReposFromConfig = async (config: GitlabConnectionConfig) =
133138

134139
const status = e?.cause?.response?.status;
135140
if (status !== undefined) {
136-
logger.error(`HTTP status: ${status}`);
137-
} else {
138-
logger.error(`HTTP status: undefined`);
141+
const warning = `GitLab API returned ${status}`
142+
logger.warning(warning);
143+
return {
144+
type: 'warning' as const,
145+
warning
146+
}
139147
}
148+
149+
logger.error("No API response status returned");
140150
throw e;
141151
}
142152
}));
@@ -166,10 +176,15 @@ export const getGitLabReposFromConfig = async (config: GitlabConnectionConfig) =
166176

167177
const status = e?.cause?.response?.status;
168178
if (status !== undefined) {
169-
logger.error(`HTTP status: ${status}`);
170-
} else {
171-
logger.error(`HTTP status: undefined`);
179+
const warning = `GitLab API returned ${status}`
180+
logger.warning(warning);
181+
return {
182+
type: 'warning' as const,
183+
warning
184+
}
172185
}
186+
187+
logger.error("No API response status returned");
173188
throw e;
174189
}
175190
}));

0 commit comments

Comments
 (0)