diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-07-29 16:43:25 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-09-14 18:59:29 -0400 |
commit | 1d085df5b796e02b3e9e6874bd4e5684e840cb92 (patch) | |
tree | 9c0bb39b7bc6e4618ed2bad4ca17af6f82b1a737 /src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs | |
parent | 2b4bc2c282e17ba431f9a6ec1892b87a37eb4bb7 (diff) | |
download | SMAPI-1d085df5b796e02b3e9e6874bd4e5684e840cb92.tar.gz SMAPI-1d085df5b796e02b3e9e6874bd4e5684e840cb92.tar.bz2 SMAPI-1d085df5b796e02b3e9e6874bd4e5684e840cb92.zip |
track license info for mod GitHub repos (#651)
Diffstat (limited to 'src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs')
-rw-r--r-- | src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs b/src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs index 04c80dd2..c14fb45d 100644 --- a/src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs +++ b/src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs @@ -32,21 +32,19 @@ namespace StardewModdingAPI.Web.Framework.ModRepositories { // validate ID format if (!uint.TryParse(id, out uint realID)) - return new ModInfoModel().WithError(RemoteModStatus.DoesNotExist, $"The value '{id}' isn't a valid Chucklefish mod ID, must be an integer ID."); + return new ModInfoModel().SetError(RemoteModStatus.DoesNotExist, $"The value '{id}' isn't a valid Chucklefish mod ID, must be an integer ID."); // fetch info try { var mod = await this.Client.GetModAsync(realID); - if (mod == null) - return new ModInfoModel().WithError(RemoteModStatus.DoesNotExist, "Found no Chucklefish mod with this ID."); - - // create model - return new ModInfoModel(name: mod.Name, version: this.NormaliseVersion(mod.Version), url: mod.Url); + return mod != null + ? new ModInfoModel(name: mod.Name, version: this.NormaliseVersion(mod.Version), url: mod.Url) + : new ModInfoModel().SetError(RemoteModStatus.DoesNotExist, "Found no Chucklefish mod with this ID."); } catch (Exception ex) { - return new ModInfoModel().WithError(RemoteModStatus.TemporaryError, ex.ToString()); + return new ModInfoModel().SetError(RemoteModStatus.TemporaryError, ex.ToString()); } } |