Skip to content

Commit

Permalink
Don't make unknown worker runtime a fatal error (#1449)
Browse files Browse the repository at this point in the history
* Minor typo in error (#1445)

* Don't make unknown worker runtime a fatal error

Closes #1445
  • Loading branch information
ahmelsayed committed Jul 19, 2019
1 parent 25b2f76 commit 8586733
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/Azure.Functions.Cli/Common/OutputTheme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ public static class OutputTheme
public static RichString ErrorColor(string value) => Red(value);
public static RichString QuestionColor(string value) => Magenta(value);
public static RichString WarningColor(string value) => Yellow(value);
public static RichString QuietWarningColor(string value) => DarkGray(value);
}
}
8 changes: 5 additions & 3 deletions src/Azure.Functions.Cli/Helpers/GlobalCoreToolsSettings.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using System.Linq;
using Azure.Functions.Cli.Interfaces;
using Colors.Net;
using static Azure.Functions.Cli.Common.OutputTheme;

namespace Azure.Functions.Cli.Helpers
{
Expand All @@ -11,11 +13,11 @@ public static WorkerRuntime CurrentWorkerRuntime
{
get
{
if (_currentWorkerRuntime != WorkerRuntime.None)
if (_currentWorkerRuntime == WorkerRuntime.None)
{
return _currentWorkerRuntime;
ColoredConsole.Error.WriteLine(QuietWarningColor("Can't determine project language from files. Please use one of [--csharp, --javascript, --typescript, --java, --python, --powershell]"));
}
throw new Exception("Can't determin project langauge from files. Please use one of [--csharp, --javascript, --typescript, --java, --python, --powershell]");
return _currentWorkerRuntime;
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/Azure.Functions.Cli.Tests/E2E/InitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public Task init_docker_only_no_project()
HasStandardError = true,
ErrorContains = new[]
{
$"Can't determin project langauge from files."
$"Can't determine project language from files."
}
}, _output);
}
Expand Down

0 comments on commit 8586733

Please sign in to comment.