1
0
Fork 0

feat(core): Pass shorthand() to draft methods

This commit is contained in:
joostdecock 2022-09-10 19:13:43 +02:00
parent 3b510fc2fb
commit ac4d134075
6 changed files with 32 additions and 52 deletions
packages/core/src

View file

@ -237,10 +237,10 @@ Pattern.prototype.draft = function () {
// Draft part
if (typeof this.__parts?.[partName]?.draft === 'function') {
try {
this.parts[partName] = this.__parts[partName].draft(this.parts[partName])
if (typeof this.parts[partName] === 'undefined') {
const result = this.__parts[partName].draft(this.parts[partName].shorthand())
if (typeof result === 'undefined') {
this.store.log.error(`Result of drafting part ${partName} was undefined. Did you forget to return the part?`)
}
} else this.parts[partName] = result
} catch (err) {
this.store.log.error([`Unable to draft part \`${partName}\``, err])
}