Browse Source

Make tye exit if dotnet fails to start projects (#588)

jkotalik/fixAzureFunctions
Justin Kotalik 6 years ago
committed by GitHub
parent
commit
d02879c29c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/Microsoft.Tye.Hosting/ProcessRunner.cs
  2. 29
      src/Microsoft.Tye.Hosting/TyeBuildException.cs
  3. 10
      src/Microsoft.Tye.Hosting/TyeHost.cs

3
src/Microsoft.Tye.Hosting/ProcessRunner.cs

@ -149,8 +149,7 @@ namespace Microsoft.Tye.Hosting
if (buildResult.ExitCode != 0)
{
_logger.LogInformation("Building projects failed with exit code {ExitCode}: \r\n" + buildResult.StandardOutput, buildResult.ExitCode);
return;
throw new TyeBuildException($"Building projects failed with exit code {buildResult.ExitCode}: \r\n{buildResult.StandardOutput}");
}
}

29
src/Microsoft.Tye.Hosting/TyeBuildException.cs

@ -0,0 +1,29 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Runtime.Serialization;
namespace Microsoft.Tye.Hosting
{
[Serializable]
internal class TyeBuildException : Exception
{
public TyeBuildException()
{
}
public TyeBuildException(string? message) : base(message)
{
}
public TyeBuildException(string? message, Exception? innerException) : base(message, innerException)
{
}
protected TyeBuildException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}

10
src/Microsoft.Tye.Hosting/TyeHost.cs

@ -91,7 +91,15 @@ namespace Microsoft.Tye.Hosting
_logger.LogInformation("Dashboard running on {Address}", app.Addresses.First());
await _processor.StartAsync(_application);
try
{
await _processor.StartAsync(_application);
}
catch (TyeBuildException ex)
{
_logger.LogError(ex.Message);
_lifetime.StopApplication();
}
if (_options.Dashboard)
{

Loading…
Cancel
Save