Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bin/commands/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function registerCommentCommands(program, { withClient }) {
? null
: (locationValues.length === 1 ? locationValues[0] : locationValues);

let comments = [];
let comments;
let nextStart = null;

if (options.all) {
Expand Down Expand Up @@ -210,7 +210,7 @@ function registerCommentCommands(program, { withClient }) {
.option('--inline-properties <json>', 'Inline properties JSON (advanced)')
.option('--match-index <n>', 'For --location inline with --inline-selection: which occurrence of the selected text to highlight (1 = first)', '1')
.action(withClient('comment_create', async ({ client, analytics, wantsJson, emitJson }, pageId, options) => {
let content = '';
let content;

if (options.file) {
if (!fs.existsSync(options.file)) {
Expand Down Expand Up @@ -245,7 +245,7 @@ function registerCommentCommands(program, { withClient }) {
inlineProperties = { ...parsed };
explicitInlineProperties = { ...parsed };
} catch (error) {
throw new Error(`Invalid --inline-properties JSON: ${error.message}`);
throw new Error(`Invalid --inline-properties JSON: ${error.message}`, { cause: error });
}
}

Expand Down
2 changes: 1 addition & 1 deletion bin/commands/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ async function exportRecursive(client, fs, path, pageId, options) {
failures.push({ id: rootPage.id, title: rootPage.title, error: error.message });
console.error(chalk.red(` Failed: ${rootPage.title} — ${error.message}`));
// Can't continue without root directory
throw new Error(`Failed to export root page: ${error.message}`);
throw new Error(`Failed to export root page: ${error.message}`, { cause: error });
}

if (delayMs > 0 && tree.length > 0) {
Expand Down
2 changes: 1 addition & 1 deletion bin/commands/properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function registerPropertyCommands(program, { withClient }) {
throw new Error('Start must be a non-negative number.');
}

let properties = [];
let properties;
let nextStart = null;

if (options.all) {
Expand Down
2 changes: 1 addition & 1 deletion lib/confluence-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -2177,7 +2177,7 @@ class ConfluenceClient {
all.push(...results);

const nextLink = data._links && data._links.next;
let nextStart = null;
let nextStart;
if (nextLink !== undefined && nextLink !== null) {
nextStart = this.parseVersionNextStart(nextLink, pageId);
if (nextStart === null) {
Expand Down
3 changes: 2 additions & 1 deletion lib/front-matter.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ function parseFrontMatter(text) {

let data;
try {
data = yaml.load(block, { schema: yaml.CORE_SCHEMA });
// js-yaml v5 throws on empty input instead of returning undefined.
data = block.trim() === '' ? undefined : yaml.load(block, { schema: yaml.CORE_SCHEMA });
} catch (error) {
throw new FrontMatterError(`Invalid YAML in front matter: ${error.reason || error.message}`);
}
Expand Down
Loading
Loading