chhoumann / quickadd

QuickAdd for Obsidian
https://quickadd.obsidian.guide
MIT License
1.53k stars 136 forks source link

Issue with nested members in templates #368

Open MichaelSGreen opened 1 year ago

MichaelSGreen commented 1 year ago

Hi!

First, I wanted to thank you for the super-useful plugin!

Here is the issue I am seeing.

Trying to use nested members to create different types of related templates. However I receive an error. (See below)

To confirm that the issue was specific to my use case, I implemented the reference use case. I am using

Additional details

This seems specific to the file creation code. Given that it works under so many different circumstances, it will create a directory, and the values of the template/filename are not illegal - it would seem the error handler is misreporting an issue. Maybe something coded via convention around an assumption that there is only one member? (I haven't seen other examples of people using this function.

Relevant info from logs: plugin:quickadd:37355 QuickAdd: (ERROR) Could not create file with template. Maybe 'Templates/NestedMemberTest.md' is an invalid template path? logError @ plugin:quickadd:37355 eval @ plugin:quickadd:31691 logError @ plugin:quickadd:31691 createFileWithTemplate @ plugin:quickadd:34667 await in createFileWithTemplate (async) run @ plugin:quickadd:37475 await in run (async) onChooseTemplateType @ plugin:quickadd:37904 execute @ plugin:quickadd:37874 onChooseItem @ plugin:quickadd:37853 t.onChooseSuggestion @ app.js:1 t.selectSuggestion @ app.js:1 e.useSelectedItem @ app.js:1 e.onSuggestionClick @ app.js:1 s @ enhance.js:1 plugin:quickadd:37355 QuickAdd: (ERROR) Could not create file 'TestWithoutSpaces.md'. logError @ plugin:quickadd:37355 eval @ plugin:quickadd:31694 logWarning @ plugin:quickadd:31694 run @ plugin:quickadd:37480 await in run (async) onChooseTemplateType @ plugin:quickadd:37904 execute @ plugin:quickadd:37874 onChooseItem @ plugin:quickadd:37853 Nested Member Test.zip

t.onChooseSuggestion @ app.js:1 t.selectSuggestion @ app.js:1 e.useSelectedItem @ app.js:1 e.onSuggestionClick @ app.js:1 s @ enhance.js:1

MichaelSGreen commented 1 year ago

I think I may have found the issue. If you break your JavaScript, which apparently I did, the error handling throws 'invalid template path'.

Maybe handling of js specific errors? Or passing the error content from the framework if it provides any?