Skip to content

Commit 1bba3ee

Browse files
committed
wip
1 parent 6e790c0 commit 1bba3ee

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/sqitch-parser/src/plan/parser.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ function parseTagLine(line: string, lastChangeName: string | null): Tag | null {
157157
// Remove the @ and parse
158158
const tagContent = line.substring(1);
159159
// Tag format: tagname timestamp planner <email> # comment
160-
const regex = /^(\S+)\s+(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z)\s+(\S+)\s+<([^>]+)>(?:\s+#\s+(.*))?$/;
160+
// Updated regex to handle planner names with spaces
161+
const regex = /^(\S+)\s+(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z)\s+(.+?)\s+<([^>]+)>(?:\s+#\s+(.*))?$/;
161162

162163
const match = tagContent.match(regex);
163164
if (!match) {
@@ -284,7 +285,13 @@ export function parsePlanFileSimple(planPath: string): PlanFile {
284285
return planWithoutTags;
285286
}
286287

287-
// Return empty plan on error
288+
// If there are errors, throw with details
289+
if (result.errors && result.errors.length > 0) {
290+
const errorMessages = result.errors.map(e => `Line ${e.line}: ${e.message}`).join('\n');
291+
throw new Error(`Failed to parse plan file ${planPath}:\n${errorMessages}`);
292+
}
293+
294+
// Return empty plan if no data and no errors
288295
return { project: '', uri: '', changes: [] };
289296
}
290297

0 commit comments

Comments
 (0)