@@ -968,30 +968,22 @@ class RepositoriesService extends Service {
968
968
969
969
/// Fetches a single release by the release tag name.
970
970
///
971
- /// Returns null if the release doesn't exist.
971
+ /// Throws a [ReleaseNotFound] exception if the release
972
+ /// doesn't exist.
972
973
///
973
974
/// API docs: https://developer.github.com/v3/repos/releases/#get-a-release-by-tag-name
974
975
Future <Release > getReleaseByTagName (
975
976
RepositorySlug slug, String tagName) async {
976
- // github.getJSON('/repos/${slug.fullName}/releases/tags/$tagName', convert: (i) => Release.fromJson(i));
977
-
978
- Release release;
979
- try {
980
- release = await github.getJSON (
981
- '/repos/${slug .fullName }/releases/tags/$tagName ' ,
982
- convert: (i) => Release .fromJson (i),
983
- statusCode: StatusCodes .OK ,
984
- fail: (http.Response response) {
985
- if (response.statusCode == 404 ) {
986
- // we just return null if the tag can't be found.
987
- throw ReleaseNotFound .fromTagName (github, tagName);
988
- }
989
- },
990
- );
991
- } on ReleaseNotFound catch (e) {
992
- release = null ;
993
- }
994
- return release;
977
+ return github.getJSON (
978
+ '/repos/${slug .fullName }/releases/tags/$tagName ' ,
979
+ convert: (i) => Release .fromJson (i),
980
+ statusCode: StatusCodes .OK ,
981
+ fail: (http.Response response) {
982
+ if (response.statusCode == 404 ) {
983
+ throw ReleaseNotFound .fromTagName (github, tagName);
984
+ }
985
+ },
986
+ );
995
987
}
996
988
997
989
/// Creates a Release based on the specified [createRelease] .
0 commit comments