Merge pull request #645 from Cyberboss/GracefulBadVersionError

Throw a JobException when there are issues downloading a BYOND version
This commit is contained in:
Jordan Brown
2018-09-14 13:48:59 -04:00
committed by GitHub
@@ -1,7 +1,9 @@
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -123,6 +125,11 @@ namespace Tgstation.Server.Host.Components.Byond
//make sure to do this last because this is what tells us we have a valid version in the future
await ioManager.WriteAllBytes(ioManager.ConcatPath(versionKey, VersionFileName), Encoding.UTF8.GetBytes(version.ToString()), cancellationToken).ConfigureAwait(false);
}
catch (WebException e)
{
//since the user can easily provide non-exitent version numbers, we'll turn this into a JobException
throw new JobException(String.Format(CultureInfo.InvariantCulture, "Error downloading BYOND version: {0}", e.Message));
}
catch (OperationCanceledException)
{
throw;