mirror of
https://github.com/10h30/wordpress-export-to-markdown.git
synced 2026-06-05 15:09:59 +09:00
Nicer error when frontmatter getter missing
This commit is contained in:
+7
-1
@@ -174,7 +174,13 @@ function populateFrontmatter(posts) {
|
||||
post.frontmatter = {};
|
||||
settings.frontmatter_fields.forEach(field => {
|
||||
[key, alias] = field.split(':');
|
||||
post.frontmatter[alias || key] = frontmatterGetters[key](post);
|
||||
|
||||
let frontmatterGetter = frontmatterGetters[key];
|
||||
if (!frontmatterGetter) {
|
||||
throw `Could not find a frontmatter getter named "${key}".`;
|
||||
}
|
||||
|
||||
post.frontmatter[alias || key] = frontmatterGetter(post);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user