-
Notifications
You must be signed in to change notification settings - Fork 331
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide a better error message when format-resource doesn’t exists
Fixes #2291
- Loading branch information
1 parent
0facbe6
commit c7c9d48
Showing
2 changed files
with
9 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ import { | |
appendDependencies, | ||
FormatResourceDependency, | ||
} from "./pandoc-dependencies.ts"; | ||
import { existsSync } from "https://deno.land/[email protected]/fs/exists.ts"; | ||
|
||
export interface FormatResource { | ||
file: string; | ||
|
@@ -32,9 +33,15 @@ export function writeFormatResources( | |
: [formatResources]; | ||
|
||
const dependencies: FormatResourceDependency[] = files.map((file) => { | ||
const absPath = join(inputDir, file); | ||
if (!existsSync(absPath)) { | ||
throw new Error( | ||
`The referenced format resource '${file}' does not exist.`, | ||
); | ||
} | ||
return { | ||
type: kFormatResources, | ||
content: { file: join(inputDir, file) }, | ||
content: { file: absPath }, | ||
}; | ||
}); | ||
appendDependencies(dependenciesFile, dependencies); | ||
|