feat: events (#717)

This commit is contained in:
Daniel Lautzenheiser
2023-04-19 23:49:53 -04:00
committed by GitHub
parent 455bcdc0f2
commit 79877fcd1f
30 changed files with 72 additions and 56 deletions

View File

@ -83,7 +83,7 @@ export const API_NAME = 'Bitbucket';
function replace404WithEmptyResponse(err: FetchError) {
if (err && err.status === 404) {
console.info('This 404 was expected and handled appropriately.');
console.info('[StaticCMS] This 404 was expected and handled appropriately.');
return { size: 0, values: [] as BitBucketFile[] } as BitBucketSrcResult;
} else {
return Promise.reject(err);
@ -235,7 +235,7 @@ export default class API {
url: `${this.repoURL}/commits`,
params: { include: branch, pagelen: '100' },
}).catch(e => {
console.info(`Failed getting commits for branch '${branch}'`, e);
console.info(`[StaticCMS] Failed getting commits for branch '${branch}'`, e);
return [];
});

View File

@ -126,7 +126,7 @@ export default class BitbucketBackend implements BackendClass {
);
})
.catch(e => {
console.warn('Failed getting BitBucket status', e);
console.warn('[StaticCMS] Failed getting BitBucket status', e);
return true;
});
@ -138,7 +138,7 @@ export default class BitbucketBackend implements BackendClass {
?.user()
.then(user => !!user)
.catch(e => {
console.warn('Failed getting Bitbucket user', e);
console.warn('[StaticCMS] Failed getting Bitbucket user', e);
return false;
})) || false;
}
@ -373,7 +373,7 @@ export default class BitbucketBackend implements BackendClass {
.then(attributes => getLargeMediaPatternsFromGitAttributesFile(attributes as string))
.catch((err: FetchError) => {
if (err.status === 404) {
console.info('This 404 was expected and handled appropriately.');
console.info('[StaticCMS] This 404 was expected and handled appropriately.');
} else {
console.error(err);
}

View File

@ -54,7 +54,7 @@ const GitGatewayAuthenticationPage = ({ onLogin, t }: GitGatewayAuthenticationPa
}
if (window.netlifyIdentity) {
console.info('Manually initializing identity widget');
console.info('[StaticCMS] Manually initializing identity widget');
initialized = true;
window.netlifyIdentity.init();
clearInterval(interval);

View File

@ -175,7 +175,7 @@ export default class GitGateway implements BackendClass {
.every((statusComponent: GitGatewayStatus) => statusComponent.status === 'operational');
})
.catch(e => {
console.warn('Failed getting Git Gateway status', e);
console.warn('[StaticCMS] Failed getting Git Gateway status', e);
return true;
});
@ -186,7 +186,7 @@ export default class GitGateway implements BackendClass {
(await this.tokenPromise?.()
.then(token => !!token)
.catch(e => {
console.warn('Failed getting Identity token', e);
console.warn('[StaticCMS] Failed getting Identity token', e);
return false;
})) || false;
}
@ -415,7 +415,7 @@ export default class GitGateway implements BackendClass {
.then((patterns: string[]) => ({ err: null, patterns }))
.catch((err: Error) => {
if (err.message.includes('404')) {
console.info('This 404 was expected and handled appropriately.');
console.info('[StaticCMS] This 404 was expected and handled appropriately.');
return { err: null, patterns: [] as string[] };
} else {
return { err, patterns: [] as string[] };
@ -461,7 +461,7 @@ export default class GitGateway implements BackendClass {
const entry = items[0];
const pointerFile = parsePointerFile(entry.data);
if (!pointerFile.sha) {
console.warn(`Failed parsing pointer file ${path}`);
console.warn(`[StaticCMS] Failed parsing pointer file ${path}`);
return { url: path, blob: new Blob() };
}

View File

@ -354,7 +354,7 @@ export default class API {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (err: any) {
if (err && err.status === 404) {
console.info('This 404 was expected and handled appropriately.');
console.info('[StaticCMS] This 404 was expected and handled appropriately.');
return [];
} else {
throw err;

View File

@ -93,7 +93,7 @@ export default class Gitea implements BackendClass {
?.user()
.then(user => !!user)
.catch(e => {
console.warn('Failed getting Gitea user', e);
console.warn('[StaticCMS] Failed getting Gitea user', e);
return false;
})) || false;

View File

@ -369,7 +369,7 @@ export default class API {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (err: any) {
if (err && err.status === 404) {
console.info('This 404 was expected and handled appropriately.');
console.info('[StaticCMS] This 404 was expected and handled appropriately.');
return [];
} else {
throw err;

View File

@ -109,7 +109,7 @@ export default class GitHub implements BackendClass {
);
})
.catch(e => {
console.warn('Failed getting GitHub status', e);
console.warn('[StaticCMS] Failed getting GitHub status', e);
return true;
});
@ -121,7 +121,7 @@ export default class GitHub implements BackendClass {
?.getUser()
.then(user => !!user)
.catch(e => {
console.warn('Failed getting GitHub user', e);
console.warn('[StaticCMS] Failed getting GitHub user', e);
return false;
})) || false;
}

View File

@ -86,7 +86,7 @@ export default class GitLab implements BackendClass {
?.user()
.then(user => !!user)
.catch(e => {
console.warn('Failed getting GitLab user', e);
console.warn('[StaticCMS] Failed getting GitLab user', e);
return false;
})) || false;