Skip to content

Commit

Permalink
proper fail on empty def
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Jun 18, 2024
1 parent 2170cb5 commit 0745136
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/runpromptcontext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ export function createChatTurnGenerationContext(
// shortcuts
if (body === undefined || body === null) {
if (!doptions.ignoreEmpty)
throw new CancelError(`def ${name} is ${body}`)
throw new Error(`def ${name} is ${body}`)
return undefined
} else if (Array.isArray(body)) {
if (body.length === 0 && !doptions.ignoreEmpty)
throw new CancelError(`def ${name} files is empty`)
throw new Error(`def ${name} is empty`)
body.forEach((f) => ctx.def(name, f, defOptions))
} else if (typeof body === "object" && body.filename) {
const { glob, endsWith } = defOptions || {}
Expand All @@ -79,7 +79,7 @@ export function createChatTurnGenerationContext(
appendChild(node, createDefNode(name, body, doptions))
} else if (typeof body === "string") {
if (body.trim() === "" && !doptions.ignoreEmpty)
throw new CancelError(`def ${name} is empty`)
throw new Error(`def ${name} is empty`)
appendChild(
node,
createDefNode(
Expand Down

0 comments on commit 0745136

Please sign in to comment.