Inspectopedia
 
2024.3

Cancellation exception handled incorrectly

Error
Reliability
New
Last modified: 03 December 2024

Reports ProcessCanceledException and CancellationException handled incorrectly.

ProcessCanceledException and its inheritors must not be caught, swallowed, logged, or handled in any way. Instead, it must be rethrown so that the IntelliJ Platform infrastructure can handle it correctly.

CancellationException must not be caught, swallowed, logged, or handled in any way in coroutine context. Instead, it must be rethrown so that the coroutines infrastructure can handle it correctly.

Inspection reports both explicit ProcessCanceledException (including inheritors) and CancellationExceptioncatching, as well as catching RuntimeException, Exception and Throwable covering cancellation exceptions.

New in 2023.2