mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-05-02 23:04:25 +02:00
fix: Handle exceptions on APIs in a more legible way
This commit is contained in:
parent
e22b643375
commit
7e8ccdff43
@ -42,9 +42,8 @@ class GithubAPI {
|
|||||||
);
|
);
|
||||||
return response.data;
|
return response.data;
|
||||||
} on Exception {
|
} on Exception {
|
||||||
// ignore
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<String>> getCommits(
|
Future<List<String>> getCommits(
|
||||||
@ -70,9 +69,8 @@ class GithubAPI {
|
|||||||
(commit['commit']['message'] as String).split('\n')[0])
|
(commit['commit']['message'] as String).split('\n')[0])
|
||||||
.toList();
|
.toList();
|
||||||
} on Exception {
|
} on Exception {
|
||||||
// ignore
|
return List.empty();
|
||||||
}
|
}
|
||||||
return List.empty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<File?> getLatestReleaseFile(String extension, String repoName) async {
|
Future<File?> getLatestReleaseFile(String extension, String repoName) async {
|
||||||
@ -104,7 +102,7 @@ class GithubAPI {
|
|||||||
patches = list.map((patch) => Patch.fromJson(patch)).toList();
|
patches = list.map((patch) => Patch.fromJson(patch)).toList();
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception {
|
||||||
// ignore
|
return List.empty();
|
||||||
}
|
}
|
||||||
return patches;
|
return patches;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ class RevancedAPI {
|
|||||||
contributors[name] = repo['contributors'];
|
contributors[name] = repo['contributors'];
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception {
|
||||||
// ignore
|
return {};
|
||||||
}
|
}
|
||||||
return contributors;
|
return contributors;
|
||||||
}
|
}
|
||||||
@ -49,9 +49,8 @@ class RevancedAPI {
|
|||||||
List<dynamic> patches = response.data;
|
List<dynamic> patches = response.data;
|
||||||
return patches.map((patch) => Patch.fromJson(patch)).toList();
|
return patches.map((patch) => Patch.fromJson(patch)).toList();
|
||||||
} on Exception {
|
} on Exception {
|
||||||
// ignore
|
return List.empty();
|
||||||
}
|
}
|
||||||
return List.empty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, dynamic>?> _getLatestRelease(
|
Future<Map<String, dynamic>?> _getLatestRelease(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user