fix: show no errors if users cancel lib install

Throwing and catching a `UserAbortError` is part of the natural flow.

Closes #2063

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
Akos Kitta 2023-05-11 15:29:06 +02:00 committed by Akos Kitta
parent 31deeebb49
commit ee43a12eb7

View File

@ -13,7 +13,7 @@ import {
} from '../../../common/protocol/installable';
import { ArduinoComponent } from '../../../common/protocol/arduino-component';
import { SearchBar } from './search-bar';
import { ListWidget } from './list-widget';
import { ListWidget, UserAbortError } from './list-widget';
import { ComponentList } from './component-list';
import { ListItemRenderer } from './list-item-renderer';
import {
@ -148,6 +148,11 @@ export class FilterableListContainer<
try {
await install({ item, progressId, version });
} catch (err) {
if (err instanceof UserAbortError) {
// Do not toast an error message on user abort.
// https://github.com/arduino/arduino-ide/issues/2063
return;
}
const message = LibraryPackage.is(item) // TODO: this dispatch does not belong here
? libraryInstallFailed(name, version)
: platformInstallFailed(name, version);