Skip to content

Commit

Permalink
feat(check_version): improve error managing when github api request f…
Browse files Browse the repository at this point in the history
…ails
  • Loading branch information
fcarrascosa committed May 9, 2021
1 parent 4b3bbd9 commit 06845dd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
21 changes: 15 additions & 6 deletions FaceitIntegration/FaceitIntegration_StreamlabsSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,22 @@ def reset_settings():
def check_version():
releases_url = 'https://api.github.com/repos/fcarrascosa/StreamlabsChatbotFaceitIntegration/releases/latest'
current_version = StrictVersion(Version)
latest_version_tag = make_get_request(Parent, releases_url)['tag_name'].replace('v', '')
latest_version = StrictVersion(latest_version_tag)

if latest_version > current_version:
new_version_body = get_message('versioning', 'new_version_body').replace('{VERSION_NAME}', latest_version_tag)
if show_confirm_dialog(get_message('versioning', 'new_version_header'), new_version_body):
os.system("explorer https://github.com/fcarrascosa/StreamlabsChatbotFaceitIntegration/releases/")
try:
latest_version_tag = make_get_request(Parent, releases_url)['tag_name'].replace('v', '')
latest_version = StrictVersion(latest_version_tag)

if latest_version > current_version:
new_version_body = get_message('versioning', 'new_version_body').replace('{VERSION_NAME}',
latest_version_tag)
if show_confirm_dialog(get_message('versioning', 'new_version_header'), new_version_body):
os.system("explorer https://github.com/fcarrascosa/StreamlabsChatbotFaceitIntegration/releases/")

except:
Parent.Log(
get_message('versioning', 'log_version_error_title'),
get_message('versioning', 'log_version_error_description')
)


def open_donation():
Expand Down
2 changes: 2 additions & 0 deletions FaceitIntegration/assets/messages/versioning.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"log_version_error_title": "FACEIT INTEGRATION - VERSION ERROR",
"log_version_error_description": "Could not retrieve Version data.",
"new_version_header": "FACEIT INTEGRATION - NEW VERSION",
"new_version_body": "New version {VERSION_NAME} has been released for FaceitIntegration\nPlease check the CHANGELOG and update.\nGo to the downloads page?"
}

0 comments on commit 06845dd

Please sign in to comment.