Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 2 additional error messages #18462

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/spelling/allow/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ colorbrewer
commandlines
consvc
copyable
CText
dalet
dcs
deselection
Expand Down
22 changes: 22 additions & 0 deletions src/cascadia/TerminalConnection/ConptyConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,28 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
TerminalOutput.raise(L"\r\n");
TerminalOutput.raise(badPathText);
}
// If the requested action requires elevation, display appropriate message
else if (hr == HRESULT_FROM_WIN32(ERROR_ELEVATION_REQUIRED))
{
const auto elevationText = RS_(L"ElevationRequired");
TerminalOutput.raise(L"\r\n");
TerminalOutput.raise(elevationText);
}
// If a stop signal (ctrl+c) is detected, display appropriate message
else if (hr == HRESULT_FROM_NT(STATUS_CONTROL_C_EXIT))
{
const auto ctrlCText = RS_(L"CtrlCToClose");
TerminalOutput.raise(L"\r\n");
TerminalOutput.raise(ctrlCText);
}
halldk marked this conversation as resolved.
Show resolved Hide resolved
// If the command or file is invalid, display appropriate message
else if (hr == HRESULT_FROM_WIN32(ERROR_BAD_COMMAND) || hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))
{
const auto badCommandText = RS_fmt(L"BadCommandOrFile", _commandline);
TerminalOutput.raise(L"\r\n");
TerminalOutput.raise(badCommandText);
}


_transitionToState(ConnectionState::Failed);

Expand Down
14 changes: 12 additions & 2 deletions src/cascadia/TerminalConnection/Resources/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
</data>
<data name="CtrlDToClose" xml:space="preserve">
<value>You can now close this terminal with Ctrl+D, or press Enter to restart.</value>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
<comment>"Ctrl+D" and "Enter" represent keys the user will press (control+D and Enter).</comment>
</data>
<data name="ProcessFailedToLaunch" xml:space="preserve">
<value>[error {0} when launching `{1}']</value>
Expand All @@ -220,4 +220,14 @@
<value>Could not access starting directory "{0}"</value>
<comment>The first argument {0} is a path to a directory on the filesystem, as provided by the user.</comment>
</data>
</root>
<data name="ElevationRequired" xml:space="preserve">
<value>The requested operation requires elevation.</value>
</data>
<data name="CtrlCToClose" xml:space="preserve">
<value>{Application Exit by CTRL+C} The application terminated as a result of a CTRL+C.</value>
</data>
halldk marked this conversation as resolved.
Show resolved Hide resolved
<data name="BadCommandOrFile" xml:space="preserve">
<value>{0} is not recognized as an internal or external command, operable program or batch file.</value>
<comment>The first argument {0} is the command or file, as provided by the user</comment>
</data>
halldk marked this conversation as resolved.
Show resolved Hide resolved
</root>
Loading