Skip to content

Commit c664f86

Browse files
committed
auth: add helper 'throw' method for GUI prompt setting
1 parent 735927f commit c664f86

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/shared/Core/Authentication/AuthenticationBase.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
using System.Diagnostics;
44
using System.IO;
55
using System.Linq;
6-
using System.Reflection;
7-
using System.Text;
86
using System.Threading;
97
using System.Threading.Tasks;
108

@@ -92,6 +90,16 @@ protected void ThrowIfUserInteractionDisabled()
9290
}
9391
}
9492

93+
protected void ThrowIfGuiPromptsDisabled()
94+
{
95+
if (!Context.Settings.IsGuiPromptsEnabled)
96+
{
97+
Context.Trace.WriteLine($"{Constants.EnvironmentVariables.GitTerminalPrompts} is 0; GUI prompts have been disabled.");
98+
99+
throw new InvalidOperationException("Cannot show prompt because GUI prompts have been disabled.");
100+
}
101+
}
102+
95103
protected void ThrowIfTerminalPromptsDisabled()
96104
{
97105
if (!Context.Settings.IsTerminalPromptsEnabled)

0 commit comments

Comments
 (0)