Allow user to cancel without showing an error message.
Closed this issue · 4 comments
If the user presses escape (or other ways of canceling out) we don't want to show an error message.
Investigate the CancellationToken? Could have a custom error type/message prefix that we ignore in the catch.
Pushed an attempt at this enhancement based on our discussion in branch: duy-esc-behavior
Think it gives us the behavior we want but I have only lightly tested it. Will come back to it after dinner.
Seems right to me code-wise. Be consistent with
if (value === undefined) {
return Promise.reject(new CancelError('escape was pressed'));
}
else if (!value) {
return Promise.reject(new Error('a different error'));
}
vs.
if (value === undefined) {
return Promise.reject(new CancelError('escape was pressed'));
}
if (!value) {
reject(new Error('Unable to create file(s): No Name Given'));
}
I would prefer the second.
here's some info on use strict
: http://stackoverflow.com/questions/1335851/what-does-use-strict-do-in-javascript-and-what-is-the-reasoning-behind-it
We should be able to set alwaysUseStrict (not sure what the actual incantation is) in the tsconfig and then when it compiles the typescript to javascript it will automatically add that for us.