Skip to content

Commit a868d8e

Browse files
committed
Metadata - error if file doesn’t exists
We were previously checking for the file’s extistence, but it seems better to error, in order to avoid things like: #8423 (reply in thread)
1 parent 46fd3c6 commit a868d8e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/config/metadata.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ export async function includedMetadata(
8080
throw e;
8181
}
8282
} else {
83-
return undefined;
83+
throw new Error(
84+
`The \`metadata-file\` ${yamlFile} doesn't exist. Please check that the path to the file is correct.`,
85+
);
8486
}
8587
})) as Array<Metadata>;
8688

@@ -220,7 +222,7 @@ export function metadataAsFormat(metadata: Metadata): Format {
220222

221223
// coalese ipynb-filter to ipynb-filters
222224
const filter = format.execute[kIpynbFilter];
223-
if (typeof (filter) === "string") {
225+
if (typeof filter === "string") {
224226
typedFormat.execute[kIpynbFilters] = typedFormat.execute[kIpynbFilters] ||
225227
[];
226228
typedFormat.execute[kIpynbFilters]?.push(filter);
@@ -302,7 +304,7 @@ export function mergeProjectMetadata<T>(
302304
return mergeConfigsCustomized<T>(
303305
(objValue: unknown, srcValue: unknown, key: string) => {
304306
if (
305-
kExandableStringKeys.includes(key) && typeof (objValue) === "string"
307+
kExandableStringKeys.includes(key) && typeof objValue === "string"
306308
) {
307309
return srcValue;
308310
} else {
@@ -361,7 +363,7 @@ export function mergeDisablableArray(objValue: unknown, srcValue: unknown) {
361363

362364
export function mergePandocVariant(objValue: unknown, srcValue: unknown) {
363365
if (
364-
typeof (objValue) === "string" && typeof (srcValue) === "string" &&
366+
typeof objValue === "string" && typeof srcValue === "string" &&
365367
(objValue !== srcValue)
366368
) {
367369
// merge srcValue into objValue

0 commit comments

Comments
 (0)