|
38 | 38 | import java.util.stream.Collectors; |
39 | 39 | import javax.annotation.Nonnull; |
40 | 40 | import javax.annotation.Nullable; |
| 41 | +import org.slf4j.Logger; |
| 42 | +import org.slf4j.LoggerFactory; |
41 | 43 |
|
42 | 44 | public final class CategoryITUtils { |
| 45 | + private static final Logger logger = LoggerFactory.getLogger(CategoryITUtils.class); |
| 46 | + |
43 | 47 | public static final String OLD_CATEGORY_CUSTOM_TYPE_KEY = "oldCategoryCustomTypeKey"; |
44 | 48 | public static final String OLD_CATEGORY_CUSTOM_TYPE_NAME = "old_type_name"; |
45 | 49 |
|
@@ -299,8 +303,13 @@ public static void deleteAllCategories(@Nonnull final ProjectApiRoot ctpClient) |
299 | 303 | } catch (NotFoundException e) { |
300 | 304 | // Already deleted, mark as deleted |
301 | 305 | deletedIds.add(categoryId); |
302 | | - } catch (Exception e) { |
303 | | - // Ignore - may have been deleted by parent cascade |
| 306 | + } catch (RuntimeException e) { |
| 307 | + // May have been deleted by parent cascade - this is expected behavior |
| 308 | + logger.debug( |
| 309 | + "Could not delete category ID: {}, key: {}. Reason: {}", |
| 310 | + categoryId, |
| 311 | + category.getKey(), |
| 312 | + e.getMessage()); |
304 | 313 | } |
305 | 314 | } |
306 | 315 | }); |
@@ -345,12 +354,18 @@ public static void deleteCategoriesBySlug( |
345 | 354 | .execute() |
346 | 355 | .toCompletableFuture() |
347 | 356 | .join(); |
348 | | - } catch (Exception e) { |
349 | | - // Ignore - already deleted or cascade deleted |
| 357 | + } catch (RuntimeException e) { |
| 358 | + // Expected: already deleted, cascade deleted, or version conflict |
| 359 | + logger.debug( |
| 360 | + "Could not delete category with slug '{}', ID: {}. Reason: {}", |
| 361 | + slug, |
| 362 | + cat.getId(), |
| 363 | + e.getMessage()); |
350 | 364 | } |
351 | 365 | }); |
352 | | - } catch (Exception e) { |
353 | | - // Ignore - slug doesn't exist |
| 366 | + } catch (RuntimeException e) { |
| 367 | + // Expected: slug doesn't exist or query failed |
| 368 | + logger.debug("Could not query categories with slug '{}'. Reason: {}", slug, e.getMessage()); |
354 | 369 | } |
355 | 370 | } |
356 | 371 | } |
|
0 commit comments