Skip to content

Commit

Permalink
Move sentinel error messaging to external file.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmhobbs committed Oct 17, 2024
1 parent d53e991 commit 0d0f788
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 3 additions & 5 deletions 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 @@ -277,11 +278,8 @@ export const waitForSentinels = async (ctx: Context, task: Task) => {
try {
await Promise.all(Object.values(sentinels).map((sentinel) => waitForSentinel(ctx, sentinel)));
} catch (err) {
throw new Error(
`Failed to finalize upload. Please check https://status.chromatic.com/ or contact support.
${err.message}`
);
ctx.log.error(sentinelFileErrors());
throw err;
}
};

Expand Down
9 changes: 9 additions & 0 deletions node-src/ui/messages/errors/sentinelFileErrors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import chalk from 'chalk';
import { dedent } from 'ts-dedent';

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

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

0 comments on commit 0d0f788

Please sign in to comment.