claremacrae / obsidian-repos-downloader

Download every approved Obsidian.md community Plugin and Theme
MIT License
25 stars 1 forks source link

Trap any errors and continue, displaying them at the end #14

Closed claremacrae closed 2 years ago

claremacrae commented 2 years ago

Even on a fast, seemingly stable internet connection, I get random errors when updating...

It's annoying - it would be more convenient to continue past the errors, and print a summary at the end.

Example output:

updating Reocin/obsidian-markdown-formatting-assistant-plugin
error: cannot pull with rebase: You have unstaged changes.
error: please commit or stash them.
Traceback (most recent call last):
  File "./obsidian-repos-downloader.py", line 174, in <module>
    download_repos()
  File "./obsidian-repos-downloader.py", line 170, in download_repos
    downloader.download()
  File "./obsidian-repos-downloader.py", line 100, in download
    self.process_released_plugins()
  File "./obsidian-repos-downloader.py", line 104, in process_released_plugins
    self.process_released_repos("plugins", PLUGINS_JSON_FILE)
  File "./obsidian-repos-downloader.py", line 117, in process_released_repos
    self.clone_repos(sorted_list)
  File "./obsidian-repos-downloader.py", line 123, in clone_repos
    self.clone_repo(plugin)
  File "./obsidian-repos-downloader.py", line 142, in clone_repo
    self.run_or_log(f"updating", command, repo)
  File "./obsidian-repos-downloader.py", line 149, in run_or_log
    subprocess.run(command, shell=True, check=True)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 487, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command 'git pull --quiet' returned non-zero exit status 128.

Ah - just read the error message, and it's not a network error!

claremacrae commented 2 years ago

This is now implemented.

An example of the output generated is:

The following errors occurred:
updating Slowbad/obsidian-solarized
command:    git pull --quiet
in:         /Users/clare/Documents/develop/Obsidian/obsidian-repos-downloader/themes/Slowbad-obsidian-solarized
exit code:  1
stdout:     
stderr:     Your configuration specifies to merge with the ref 'refs/heads/master'
from the remote, but no such ref was fetched.

-------------------------------------------------------------------------------
claremacrae commented 2 years ago

Fixed in the 1.1.2 release