MCPcopy
hub / github.com/conwnet/github1s / detectErrorMessage

Function detectErrorMessage

extensions/github1s/src/adapters/gitlab1s/fetcher.ts:30–41  ·  view source on GitHub ↗
(response: any, authenticated: boolean)

Source from the content-addressed store, hash-verified

28};
29
30const detectErrorMessage = (response: any, authenticated: boolean) => {
31 if (response?.status === 401 && response?.data?.message?.includes?.('Unauthorized')) {
32 return errorMessages.badCredentials[authenticated ? 'authenticated' : 'anonymous'];
33 }
34 if (response?.status === 404) {
35 return errorMessages.repoNotFound[authenticated ? 'authenticated' : 'anonymous'];
36 }
37 if (response?.status === 403) {
38 return errorMessages.noPermission[authenticated ? 'authenticated' : 'anonymous'];
39 }
40 return response?.data?.message || response?.data?.error || '';
41};
42
43const PREFER_SOURCEGRAPH_API = 'PREFER_SOURCEGRAPH_API';
44

Callers 1

GitLabFetcherClass · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected