Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Hide error messages if the user is offline #211

Closed
Tiim opened this issue Mar 26, 2022 · 9 comments
Closed

[Feature Request]: Hide error messages if the user is offline #211

Tiim opened this issue Mar 26, 2022 · 9 comments
Labels
enhancement New feature or request

Comments

@Tiim
Copy link

Tiim commented Mar 26, 2022

One of the benefits of using git is the possibility to work offline. Unfortunately this plugin assumes that we are always online, and shows error messages if the git command failed, which is very distracting especially if the intervall is set to a short amount of time.

Relevant errors (if available)

No response

Steps to reproduce

  • Disconnect from the internet
  • Wait for obsidian-git to make an automatic backup or initialise one manually

Expected Behavior

There should not be a message every time obsidian-git tries to connect. A message the first time is fine, but even better just show "Offline" in the status bar.

Addition context

No response

Operating system

Windows

Plugin version

1.24.1

@Vinzent03
Copy link
Collaborator

Interesting idea, but I wouldn't call it a bug. It's much more a feature to go into "offline mode". Could you share the error, when you're offline?

@Vinzent03 Vinzent03 added the enhancement New feature or request label Mar 27, 2022
@Tiim
Copy link
Author

Tiim commented Mar 29, 2022

Yes you are right. It is probably more a feature request.

This is the notification I get when im offline:
grafik

And this is the console output:

Uncaught (in promise) Error: ssh: Could not resolve hostname github.com: Name or service not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

    at Object.action (eval at <anonymous> (app.js:1), <anonymous>:10544:25)
    at PluginStore.exec (eval at <anonymous> (app.js:1), <anonymous>:10569:25)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:8382:43)
    at new Promise (<anonymous>)
    at GitExecutorChain.handleTaskData (eval at <anonymous> (app.js:1), <anonymous>:8380:16)
    at GitExecutorChain.eval (eval at <anonymous> (app.js:1), <anonymous>:8364:44)
    at Generator.next (<anonymous>)
    at fulfilled (eval at <anonymous> (app.js:1), <anonymous>:7216:24)
    at processTicksAndRejections (internal/process/task_queues.js:93)

@Tiim Tiim changed the title [Bug]: Error messages if the user is offline [Feature Request]: Error messages if the user is offline Mar 29, 2022
@Tiim Tiim changed the title [Feature Request]: Error messages if the user is offline [Feature Request]: Hide error messages if the user is offline Mar 29, 2022
@timmb
Copy link

timmb commented Aug 11, 2022

This is still a problem for me and it means I have to disable the plugin when working without access to my Git server. I get an intrusive purple popup box every minute as it tries to push.

It may be a factor that I'm using a VPN to connect to my own Git server rather than using Github. But the problem persists both when I'm offline and when I'm online but my server is unavailable.

Rather than trying to detect when I'm offline, a simpler and more general solution might be an option to disable the pop-up notifications on errors to git push and have a little check or cross in the status bar instead to indicate the last status, similar to Obsidian Sync.

@Vinzent03
Copy link
Collaborator

@timmb What is the exact error message?

@timmb
Copy link

timmb commented Aug 11, 2022

git obsidian error: ssh: connect to host 192.168.X.X port X: Operation timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

plugin:obsidian-git:10760 Uncaught (in promise) Error: ssh: connect to host 192.168.X.X port X: Operation timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

    at Object.action (plugin:obsidian-git:10760:25)
    at PluginStore.exec (plugin:obsidian-git:10785:25)
    at eval (plugin:obsidian-git:8505:43)
    at new Promise (<anonymous>)
    at GitExecutorChain.handleTaskData (plugin:obsidian-git:8503:16)
    at GitExecutorChain.eval (plugin:obsidian-git:8487:44)
    at Generator.next (<anonymous>)
    at fulfilled (plugin:obsidian-git:7339:24)

NB, local IP as I connect via VPN. Right now the VPN is disabled so it cannot connect. (IP/port redacted)

@Vinzent03
Copy link
Collaborator

@timmb Thanks, I'm currently searching for 'Could not resolve host', but this is not included in your error. The problem is your error is more like when you try to push to an GitHub repo, where you don't have the rights for. Like it can connect to the server, but can't read the repo. I think hiding the error in general is not at good idea, because many need it to debug there config.

@timmb
Copy link

timmb commented Aug 11, 2022

error.message.match(/ssh: connect to host .*? port .*?: Operation timed out/) might work?

Another option is to only show the first error message as a popup and then show the error state in the status bar but no more popup errors until after we've left the error state. A single error is fine and it will linger until it's acknowledged.

Vinzent03 added a commit that referenced this issue Aug 22, 2022
@timmb
Copy link

timmb commented Nov 1, 2022

Unfortunately I still have this issue in version 2.8.0. When I'm offline I have to manually disable the plugin.

The error I see now is:

Uncaught (in promise) Error: ssh: connect to host 192.168.18.11 port 47212: Network is unreachable
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

    at Object.action (plugin:obsidian-git:23900:25)
    at PluginStore.exec (plugin:obsidian-git:23925:25)
    at eval (plugin:obsidian-git:21512:43)
    at new Promise (<anonymous>)
    at GitExecutorChain.handleTaskData (plugin:obsidian-git:21510:16)
    at GitExecutorChain.eval (plugin:obsidian-git:21494:44)
    at Generator.next (<anonymous>)
    at fulfilled (plugin:obsidian-git:20343:24)

This is probably because I rely on a VPN to connect.

Simplest is to also add in error.message.match(/ssh: connect to host .*? port .*?: Network is unreachable/).

Vinzent03 added a commit that referenced this issue Nov 2, 2022
@Vinzent03
Copy link
Collaborator

Vinzent03 commented Nov 2, 2022

The network error message is always a bit different, isn't it? Should be fixed now, again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants