Skip to content

Commit

Permalink
Merge pull request #1094 from chromaui/jmhobbs/cap-2266-misleading-er…
Browse files Browse the repository at this point in the history
…ror-during-downtime

Add context to sentinel upload failures.
  • Loading branch information
jmhobbs authored Oct 17, 2024
2 parents 9cd04ad + f4d4a94 commit f1bfdb4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
8 changes: 7 additions & 1 deletion node-src/tasks/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { rewriteErrorMessage, throttle } from '../lib/utils';
import { waitForSentinel } from '../lib/waitForSentinel';
import { Context, FileDesc, Task } from '../types';
import missingStatsFile from '../ui/messages/errors/missingStatsFile';
import sentinelFileErrors from '../ui/messages/errors/sentinelFileErrors';
import bailFile from '../ui/messages/warnings/bailFile';
import deviatingOutputDirectory from '../ui/messages/warnings/deviatingOutputDirectory';
import {
Expand Down Expand Up @@ -274,7 +275,12 @@ export const waitForSentinels = async (ctx: Context, task: Task) => {
})
);

await Promise.all(Object.values(sentinels).map((sentinel) => waitForSentinel(ctx, sentinel)));
try {
await Promise.all(Object.values(sentinels).map((sentinel) => waitForSentinel(ctx, sentinel)));
} catch (err) {
ctx.log.error(sentinelFileErrors());
throw err;
}
};

export default createTask({
Expand Down
7 changes: 7 additions & 0 deletions node-src/ui/messages/errors/sentinelFileErrors.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import sentinelFileErrors from './sentinelFileErrors';

export default {
title: 'CLI/Messages/Errors',
};

export const SentinelFileErrors = () => sentinelFileErrors();
10 changes: 10 additions & 0 deletions node-src/ui/messages/errors/sentinelFileErrors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import chalk from 'chalk';
import { dedent } from 'ts-dedent';

import { error } from '../../components/icons';
import link from '../../components/link';

export default () =>
dedent(chalk`
${error} Failed to finalize upload. Please check ${link('https://status.chromatic.com/')} or contact support.
`);

0 comments on commit f1bfdb4

Please sign in to comment.