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
365 stars 12 forks source link

A setting for how long to display error messages #7

Closed Taitava closed 3 years ago

Taitava commented 3 years ago

If a command fails, the error message stays just a few seconds on screen. Maybe create a setting for how long to display any notice messages (= errors)?

Search all occurrences of:

new Notice("error message");

... and add a timeout parameter:

new Notice("error message", timeout_value);
Taitava commented 3 years ago

Create a helper function for this in Common.ts ShellCommandsPlugin:

newError(message: string) {
  let timeout_value = *retrieve from settings*;
  new Notice(message, timeout_value);
}

This way all places that throw errors will use a common helper function, and it's possible to later change the appearance of error messages to something else than a Notice, if ever needed.

Taitava commented 3 years ago

Released.