Skip to content

Commit

Permalink
fix: show error notices for a longer time
Browse files Browse the repository at this point in the history
close #148
  • Loading branch information
Vinzent03 committed Dec 9, 2021
1 parent 96dcbc4 commit d455489
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,15 +492,15 @@ export default class ObsidianGit extends Plugin {
this.statusBar?.displayMessage(message.toLowerCase(), timeout);

if (!this.settings.disablePopups) {
new Notice(message);
new Notice(message, 5 * 1000);
}

console.log(`git obsidian message: ${message}`);
}
displayError(message: any, timeout: number = 0): void {
// Some errors might not be of type string
message = message.toString();
new Notice(message);
new Notice(message, 15 * 1000);
console.log(`git obsidian error: ${message}`);
this.statusBar?.displayMessage(message.toLowerCase(), timeout);
}
Expand Down
7 changes: 7 additions & 0 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,5 +257,12 @@ export class ObsidianGitSettingsTab extends PluginSettingTab {
plugin.gitManager.updateGitPath(value || "git");
});
});
const info = containerEl.createDiv();
info.setAttr("align", "center");
info.setText("Debugging and logging:\nYou can always see the logs of this and every other plugin by opening the console with");
const keys = containerEl.createDiv();
keys.setAttr("align", "center");
keys.addClass("obsidian-git-shortcuts");
keys.createEl("kbd", { text: "CTRL + SHIFT + I" });
}
}
1 change: 1 addition & 0 deletions src/simpleGit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ export class SimpleGit extends GitManager {
private onError(error: Error | null) {
if (error) {
this.plugin.displayError(error.message);
this.plugin.setState(PluginState.idle);
}
}
}
3 changes: 3 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@
}
.tooltip.mod-right {
overflow-wrap: break-word;
}
.obsidian-git-shortcuts{
margin: 10px;
}

0 comments on commit d455489

Please sign in to comment.