| 1 | /** |
| 2 | * Preserve both the reconcile failure and a subsequent cleanup failure. |
| 3 | * |
| 4 | * Cleanup failures are operationally important: suppressing one can leave an |
| 5 | * untracked cloud resource behind with no indication of how to remove it. |
| 6 | */ |
| 7 | export const aggregateCleanupFailure = ( |
| 8 | resource: "App" | "deployment", |
| 9 | resourceId: string, |
| 10 | route: string, |
| 11 | originalError: unknown, |
| 12 | cleanupError: unknown, |
| 13 | ) => |
| 14 | new AggregateError( |
| 15 | [originalError, cleanupError], |
| 16 | `Failed to clean up Prisma ${resource} '${resourceId}' after reconcile failed. The resource may be orphaned. Manual cleanup: DELETE ${route}.`, |
| 17 | ); |