Skip to content

Commit

Permalink
add error handling for incorrect note name
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhl8 committed Jul 6, 2022
1 parent 653e90f commit de104e1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dataviewjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ const headers = new Set(defaultHeaders) // Set of task names to be used as table
const rows = []

const noteDay = dv.current().file.day
if (!noteDay)
throw {
stack:
'(If this note is your template, this error is expected.) Unable to get note\'s day. Note should be named in the "YYYY-MM-DD" format.',
}

const pages = dv
.pages('"Daily Notes"')
.where((p) => p.file.day >= noteDay.minus({ days: 7 })) // Only include previous week in table.
Expand Down

0 comments on commit de104e1

Please sign in to comment.