Skip to content

Allow exceptions from ITerminalApi and TerminalDispatch#12432

Merged
DHowett merged 3 commits intomicrosoft:mainfrom
j4james:exceptions-in-terminal
Feb 9, 2022
Merged

Allow exceptions from ITerminalApi and TerminalDispatch#12432
DHowett merged 3 commits intomicrosoft:mainfrom
j4james:exceptions-in-terminal

Conversation

@j4james
Copy link
Collaborator

@j4james j4james commented Feb 8, 2022

This PR updates the ITerminalApi and TerminalDispatch classes to
allow exceptions to be thrown in case of errors instead of using boolean
return values.

References

This brings the Terminal code into alignment with the AdaptDispatch
and ConGetSet changes made in PR #12247.

And while this isn't exactly a fix for #12378, it does at least stop the
app from crashing now.

PR Checklist

Detailed Description of the Pull Request / Additional comments

All the TerminalDispatch methods have had their noexcept specifiers
dropped, and any try/catch wrapping removed, so exceptions will now
fall through to the StateMachine class where they should be safely
caught and logged.

The same goes for the ITerminalApi interface and its implementation in
the Terminal class. And many of the methods in this interface have
also had their bool return values changed to void, since there is
usually not a need for error return values now.

Validation Steps Performed

I've manually tested the OSC 9;9 sequence described in #12378 and
confirmed that it no longer crashes.

@zadjii-msft zadjii-msft added the AutoMerge Marked for automatic merge by the bot when requirements are met label Feb 8, 2022
@ghost
Copy link

ghost commented Feb 8, 2022

Hello @zadjii-msft!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

Do note that I've been instructed to only help merge pull requests of this repository that have been opened for at least 8 hours, a condition that will be fulfilled in about 4 hours 31 minutes. No worries though, I will be back when the time is right! 😉

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@DHowett
Copy link
Member

DHowett commented Feb 9, 2022

Love it! Thanks

@DHowett DHowett merged commit 9c11e02 into microsoft:main Feb 9, 2022
DHowett pushed a commit that referenced this pull request Feb 9, 2022
This PR updates the `ITerminalApi` and `TerminalDispatch` classes to
allow exceptions to be thrown in case of errors instead of using boolean
return values.

## References

This brings the Terminal code into alignment with the `AdaptDispatch`
and `ConGetSet` changes made in PR #12247.

And while this isn't exactly a fix for #12378, it does at least stop the
app from crashing now.

## Detailed Description of the Pull Request / Additional comments

All the `TerminalDispatch` methods have had their `noexcept` specifiers
dropped, and any `try`/`catch` wrapping removed, so exceptions will now
fall through to the `StateMachine` class where they should be safely
caught and logged.

The same goes for the `ITerminalApi` interface and its implementation in
the `Terminal` class. And many of the methods in this interface have
also had their `bool` return values changed to `void`, since there is
usually not a need for error return values now.

## Validation Steps Performed

I've manually tested the `OSC 9;9` sequence described in #12378 and
confirmed that it no longer crashes.

(cherry picked from commit 9c11e02)
@j4james j4james deleted the exceptions-in-terminal branch February 10, 2022 01:09
@ghost
Copy link

ghost commented Feb 11, 2022

🎉Windows Terminal Preview v1.13.10395.0 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AutoMerge Marked for automatic merge by the bot when requirements are met

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants