mirror of
https://github.com/callumalpass/tasknotes.git
synced 2026-07-22 12:50:26 +00:00
fix: handle missing daily notes folder when creating timeblocks (#780)
Wraps createDailyNote calls in try-catch blocks to properly handle errors when the daily notes folder doesn't exist. Provides clear error messages guiding users to check their Daily Notes plugin configuration.
This commit is contained in:
parent
8f965611aa
commit
117ff88097
3 changed files with 26 additions and 4 deletions
|
|
@ -9,14 +9,14 @@
|
|||
**Fixed** for any bug fixes.
|
||||
**Security** in case of vulnerabilities.
|
||||
|
||||
Always acknowledge contributors and those who report issues.
|
||||
Always acknowledge contributors and those who report issues.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
## Fixed
|
||||
|
||||
- (#768) Fixed calendar view appearing empty in week and day views due to invalid time configuration values
|
||||
- (#768) Fixed calendar view appearing empty in week and day views due to invalid time configuration values
|
||||
- Added time validation in settings UI with proper error messages and debouncing
|
||||
- Added runtime sanitization in calendar with safe defaults (00:00:00, 24:00:00, 08:00:00)
|
||||
- Prevents "Cannot read properties of null (reading 'years')" error from FullCalendar
|
||||
|
|
@ -25,3 +25,11 @@ Example:
|
|||
|
||||
-->
|
||||
|
||||
## Fixed
|
||||
|
||||
- (#780) Fixed "Cannot Create Timeblocks" error when daily notes folder doesn't exist
|
||||
- Added proper error handling when `createDailyNote` fails due to missing folder
|
||||
- Improved error messages to guide users to check Daily Notes plugin configuration
|
||||
- Prevents uncaught errors from `obsidian-daily-notes-interface` package
|
||||
- Thanks to @uberunix for reporting
|
||||
|
||||
|
|
|
|||
|
|
@ -248,7 +248,14 @@ export class TimeblockCreationModal extends Modal {
|
|||
|
||||
if (!dailyNote) {
|
||||
// Create daily note if it doesn't exist
|
||||
dailyNote = await createDailyNote(moment);
|
||||
try {
|
||||
dailyNote = await createDailyNote(moment);
|
||||
} catch (error) {
|
||||
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||
throw new Error(
|
||||
`Failed to create daily note: ${errorMessage}. Please check your Daily Notes plugin configuration and ensure the daily notes folder exists.`
|
||||
);
|
||||
}
|
||||
|
||||
// Validate that daily note was created successfully
|
||||
if (!dailyNote) {
|
||||
|
|
|
|||
|
|
@ -1227,7 +1227,14 @@ async function addTimeblockToDailyNote(
|
|||
let dailyNote = getDailyNote(moment, allDailyNotes);
|
||||
|
||||
if (!dailyNote) {
|
||||
dailyNote = await createDailyNote(moment);
|
||||
try {
|
||||
dailyNote = await createDailyNote(moment);
|
||||
} catch (error) {
|
||||
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||
throw new Error(
|
||||
`Failed to create daily note: ${errorMessage}. Please check your Daily Notes plugin configuration and ensure the daily notes folder exists.`
|
||||
);
|
||||
}
|
||||
|
||||
// Validate that daily note was created successfully
|
||||
if (!dailyNote) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue