Skip to content
Snippets Groups Projects
Commit 4aeac6bb authored by henry's avatar henry Committed by henry
Browse files

fixup! TB 40597: Implement TorSettings module

TB 43488: Skip straight to "FinalError" if we do not get an expected
TorConnectError.
parent f37f63bc
No related branches found
1 merge request!1443Skip straight to "FinalError" if we do not get an expected TorConnectError
Pipeline #260194 passed
......@@ -1441,28 +1441,45 @@ export const TorConnect = {
this._signalError(error);
let errorStage = TorConnectStage.FinalError;
switch (beginStage) {
case TorConnectStage.Start:
case TorConnectStage.Offline:
this._setStage(TorConnectStage.ChooseRegion);
return;
if (
error instanceof TorConnectError &&
error.code === TorConnectError.BootstrapError
) {
errorStage = TorConnectStage.ChooseRegion;
}
// Else, some other unexpected error type. Skip straight to the
// "FinalError". See tor-browser#43488.
break;
case TorConnectStage.ChooseRegion:
if (regionCode === "automatic") {
// TODO: Handle a Moat error of the type
// DomainFrontRequestNetworkError to show a different stage. See
// tor-browser#43569.
if (
regionCode === "automatic" &&
error instanceof TorConnectError &&
(error.code === TorConnectError.AllSettingsFailed ||
error.code === TorConnectError.CannotDetermineCountry ||
error.code === TorConnectError.NoSettingsForCountry)
) {
// The automatic region failed.
if (bootstrapAttempt.detectedRegion) {
this._setStage(TorConnectStage.ConfirmRegion);
} else {
this._setStage(TorConnectStage.RegionNotFound);
}
return;
errorStage = bootstrapAttempt.detectedRegion
? TorConnectStage.ConfirmRegion
: TorConnectStage.RegionNotFound;
}
// Else, not automatic. Go straight to the final error since the user
// is unlikely to succeed re-selecting the same region and it would be
// unexpected for the user to select a different region.
// See tor-browser#42550.
// Else, some other error type. Skip straight to the "FinalError". See
// tor-browser#43488.
break;
}
this._setStage(TorConnectStage.FinalError);
this._setStage(errorStage);
return;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment