splitwise / src /lib /server /ledger /errors.ts
assafvayner's picture
assafvayner HF Staff
feat(ledger): add Ledger service with event write path and compaction
3bfa0fc
Raw
History Blame Contribute Delete
603 Bytes
export class ConflictError extends Error {
constructor(
public readonly entityId: string,
public readonly currentVersion: number
) {
super(`Entity ${entityId} was modified (current version ${currentVersion})`);
this.name = 'ConflictError';
}
}
export class NotFoundError extends Error {
constructor(public readonly entityId: string) {
super(`Entity ${entityId} not found`);
this.name = 'NotFoundError';
}
}
export class ReadOnlyError extends Error {
constructor() {
super('The app is in read-only mode: another instance holds the writer lock');
this.name = 'ReadOnlyError';
}
}