EA-1129470: don't wrap AlreadyDisposed in PCE if under !cancellable section

GitOrigin-RevId: bd71f3212b87df14a42ca06989ec88b190c6d20e
This commit is contained in:
Ruslan Cheremin
2024-03-22 23:31:58 +00:00
committed by intellij-monorepo-bot
parent f1c8e83733
commit 4ab47254fe
@@ -1,5 +1,6 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@file:ApiStatus.Internal
package com.intellij.serviceContainer
import com.intellij.ide.plugins.PluginManagerCore
@@ -46,7 +47,10 @@ fun throwAlreadyDisposedError(serviceDescription: String, componentManager: Comp
*/
@ApiStatus.Internal
fun wrapAlreadyDisposedError(error: AlreadyDisposedException): RuntimeException {
if (!isUnderIndicatorOrJob()) {
if (Cancellation.isInNonCancelableSection()) {
return error
}
else if (!isUnderIndicatorOrJob()) {
return error
}
else {