nit: improve error reporting on git sync jobs by printing error msg (#6928)

This commit is contained in:
Alexander Petric
2025-10-23 15:25:59 -04:00
committed by GitHub
parent 53d8fbe508
commit 26cf0ca14e
2 changed files with 22 additions and 5 deletions

View File

@@ -29,6 +29,7 @@ export type GitSyncRepository = BackendGitRepositorySettings & {
export type GitSyncTestJob = {
jobId: string
status: 'running' | 'success' | 'failure' | undefined
error?: string
}
export type GitSyncSettings = {
@@ -547,14 +548,25 @@ export function createGitSyncContext(workspace: string) {
onProgress: (status) => {
gitSyncTestJobs[idx].status = status.status === 'success' ? 'success' :
status.status === 'failure' ? 'failure' : 'running'
if (status.status === 'failure') {
gitSyncTestJobs[idx].error = status.error
}
}
}
)
// If we get here, the job completed successfully
gitSyncTestJobs[idx].status = 'success'
} catch (error) {
gitSyncTestJobs[idx].status = 'failure'
} catch (error: any) {
// Initialize the job entry if it doesn't exist (e.g., job creation failed)
const errorMessage = (typeof error?.body === 'string' ? error.body : error?.body?.message) || error?.message || error?.toString() || 'Failed to run test job'
if (!gitSyncTestJobs[idx]) {
gitSyncTestJobs[idx] = {
jobId: '',
status: 'failure',
error: errorMessage
}
} else {
gitSyncTestJobs[idx].status = 'failure'
gitSyncTestJobs[idx].error = errorMessage
}
}
}

View File

@@ -305,6 +305,11 @@
</a>
<span class="text-secondary">WARNING: Only read permissions are verified.</span>
</div>
{#if gitSyncTestJob.status === 'failure' && gitSyncTestJob.error}
<div class="text-red-600 text-xs mt-1">
Error: {gitSyncTestJob.error}
</div>
{/if}
{/if}
<!-- Warnings -->