Files
stack/apps/api/src/common/exceptions/concurrent-update.exception.ts
Jason Woltje a0dc2f798c
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
fix(#196, #199): Fix TypeScript errors from race condition and throttler changes
- Regenerated Prisma client to include version field from #196
- Updated ThrottlerValkeyStorageService to match @nestjs/throttler v6.5 interface
  - increment() now returns ThrottlerStorageRecord with totalHits, timeToExpire, isBlocked
  - Added blockDuration and throttlerName parameters to match interface
- Added null checks for job variable after length checks in coordinator-integration.service.ts
- Fixed template literal type error in ConcurrentUpdateException
- Removed unnecessary await in throttler-storage.service.ts
- Fixes pipeline 79 typecheck failure

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-02 13:31:47 -06:00

24 lines
885 B
TypeScript

import { ConflictException } from "@nestjs/common";
/**
* Exception thrown when a concurrent update conflict is detected
* This occurs when optimistic locking detects that a record has been
* modified by another process between read and write operations
*/
export class ConcurrentUpdateException extends ConflictException {
constructor(resourceType: string, resourceId: string, currentVersion?: number) {
const message = currentVersion
? `Concurrent update detected for ${resourceType} ${resourceId} at version ${String(currentVersion)}. The record was modified by another process.`
: `Concurrent update detected for ${resourceType} ${resourceId}. The record was modified by another process.`;
super({
message,
error: "Concurrent Update Conflict",
resourceType,
resourceId,
currentVersion,
retryable: true,
});
}
}