added no-results text (#192)

Fixes #182: Added no-results text
pull/197/head
Nesbeer 2022-12-14 15:51:06 +05:30 committed by GitHub
parent 25cefed095
commit 79e1151ee6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -26,7 +26,11 @@ export async function queryDirectiveRenderer(
const rendered = await renderTemplate(parsedQuery.render, results[0]);
return rendered.trim();
} else {
return jsonToMDTable(results[0]);
if (results[0].length === 0) {
return "No results";
} else {
return jsonToMDTable(results[0]);
}
}
} else {
throw new Error(`Too many query results: ${results.length}`);