Skip parsing issues for failing lines
This commit is contained in:
@@ -17,6 +17,7 @@ export async function remind(config: Config, db: NotificationDatabase) {
|
|||||||
|
|
||||||
for (const notification of notifications) {
|
for (const notification of notifications) {
|
||||||
for (const backend of backends) {
|
for (const backend of backends) {
|
||||||
|
console.info(`Dispatching a notification: [${notification.text}]`)
|
||||||
backend.remind(config, notification);
|
backend.remind(config, notification);
|
||||||
await snooze(1500);
|
await snooze(1500);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,10 +70,20 @@ async function readTasksFromFile(path: string): Promise<Task[]> {
|
|||||||
const list: Task[] = [];
|
const list: Task[] = [];
|
||||||
|
|
||||||
for await (const line of lines) {
|
for await (const line of lines) {
|
||||||
const task = parseTask(line);
|
try {
|
||||||
|
const task = parseTask(line);
|
||||||
|
|
||||||
if(task) {
|
if(task) {
|
||||||
list.push(task);
|
list.push(task);
|
||||||
|
}
|
||||||
|
} catch(e: any) {
|
||||||
|
console.warn(`Parsing error in file '${path}', for line:`);
|
||||||
|
console.warn(line);
|
||||||
|
if(e.location) {
|
||||||
|
console.warn(' '.repeat(e.location.start.column + 2) + "^" + '~'.repeat(e.location.end.column - e.location.start.column - 1) + "^")
|
||||||
|
}
|
||||||
|
console.warn(e.message);
|
||||||
|
console.warn("This line will be ignored. Please check the source and adjust it accordingly.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export async function test(config: Config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function scan(config: Config) {
|
export async function scan(config: Config) {
|
||||||
const tasks = await loadTasks(config.sources, config.query);
|
const tasks = await loadTasks(config.sources, config.query);
|
||||||
dumpDatabase(config.databaseFile, tasks, config.mapper);
|
dumpDatabase(config.databaseFile, tasks, config.mapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user