Taitava / obsidian-shellcommands

Execute system commands via hotkeys or command palette in Obsidian (https://obsidian.md). Some automated events are also supported, and execution via URI links.
GNU General Public License v3.0
348 stars 11 forks source link

Bug: {{event_yaml_value}} gives wrong error message when the wanted property is not found #220

Closed Taitava closed 2 years ago

Taitava commented 2 years ago

When {{event_yaml_value:non_existing_property}} is used in a shell command that is executed using the File menu event, the following error message is displayed:

{{event_yaml_value}}: This variable can only be used during events: File menu

The error message is wrong. It should be:

YAML property 'non_existing_property' is not found.

Or:

No YAML frontmatter section is defined for the current file.

The cause

When Variable.getValue() generates error messages, it does not pass an SC_Event instance to Variable.generateValue():

https://github.com/Taitava/obsidian-shellcommands/blob/cc594bf58407849cb5e32a6ba6686ec248382e9c/src/variables/Variable.ts#L103

This leads Variable.generateValue() to report a different error. It's easy to fix.

Taitava commented 2 years ago

Fixed, but I haven't yet decided if I'll make a patch release 0.12.1 for this, or will I release it in 0.13.0. If other, more prominent bugs are found, then I might make 0.12.1, but otherwise this can wait till 0.13.0.

Taitava commented 2 years ago

Will be released in 0.13.0 0.12.1.