Skip to content

Commit

Permalink
Catch error thrown when GitHub api ignores a request
Browse files Browse the repository at this point in the history
  • Loading branch information
Ecks1337 committed Jan 20, 2023
1 parent ff58142 commit 1c29692
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "RyuSAK",
"productName": "RyuSAK",
"version": "1.6.1",
"version": "1.6.2",
"description": "RyuSAK",
"repository": "https://github.com/Ecks1337/RyuSAK",
"main": ".webpack/main",
Expand Down
19 changes: 12 additions & 7 deletions src/main/services/HttpService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,21 @@ class HttpService {

public async getLatestApplicationVersion() {
// Do not use this.get because we do not want exponential backoff strategy since GitHub api is limited to 10 requests per minute for unauthenticated requests
const response = await this.fetch(OTHER_URLS.RELEASE_INFO);
try {
const response = await this.fetch(OTHER_URLS.RELEASE_INFO);

if (response.status != 200) {
return app.getVersion();
}
if (response.status == 200) {
const responseJson = await response.json() as any;
const tagName = responseJson.tag_name as string;

const responseJson = await response.json() as any;
const tagName = responseJson.tag_name as string;
return tagName.replace("v", "");
}
}
catch (e) {
console.error(e);
}

return tagName.replace("v", "");
return app.getVersion();
}

public async downloadKeys(retries = 3) {
Expand Down

0 comments on commit 1c29692

Please sign in to comment.