Skip to content

Commit 8bdf532

Browse files
committed
chore(dev-utils): Update sassdoc to not through uncaught exceptions
1 parent aa5ecfd commit 8bdf532

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

packages/dev-utils/src/sassdoc.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@ function getReferenceLinks(
231231
);
232232

233233
if (!link) {
234-
throw new Error(`Unable to find a reference for ${name} ${type}`);
234+
log.error(`Unable to find a reference for ${name} ${type}`);
235+
process.exit(1);
235236
}
236237

237238
const key = `${name}-${type}`;
@@ -428,7 +429,10 @@ function getPackageRecord(
428429

429430
const record = lookup[packageName];
430431
if (!record) {
431-
throw new Error();
432+
log.error(
433+
`This should never happen. No PackageSassDocMap for "${packageName}"`
434+
);
435+
process.exit(1);
432436
}
433437

434438
return record;
@@ -454,9 +458,8 @@ export async function sassdoc(): Promise<void> {
454458
const variable = formatVariableItem(item, references);
455459
const { name } = variable;
456460
if (packageDoc.variables[name]) {
457-
throw new Error(
458-
`${name} already exists in ${packageName}'s variables...`
459-
);
461+
log.error(`${name} already exists in ${packageName}'s variables...`);
462+
process.exit(1);
460463
}
461464

462465
packageDoc.variables[name] = variable;
@@ -466,9 +469,8 @@ export async function sassdoc(): Promise<void> {
466469
const func = formatFunctionItem(item, references);
467470
const { name } = func;
468471
if (packageDoc.functions[name]) {
469-
throw new Error(
470-
`${name} already exists in ${packageName}'s functions...`
471-
);
472+
log.error(`${name} already exists in ${packageName}'s functions...`);
473+
process.exit(1);
472474
}
473475

474476
packageDoc.functions[name] = func;
@@ -478,7 +480,8 @@ export async function sassdoc(): Promise<void> {
478480
const mixin = formatMixinItem(item, references);
479481
const { name } = mixin;
480482
if (packageDoc.mixins[name]) {
481-
throw new Error(`${name} already exists in ${packageName}'s mixins...`);
483+
log.error(`${name} already exists in ${packageName}'s mixins...`);
484+
process.exit(1);
482485
}
483486

484487
packageDoc.mixins[name] = mixin;

0 commit comments

Comments
 (0)