fix: add error handling for CashboxExportScheduler subscription processing
- Wrap runOne(subscription) in try/catch to ensure one subscription failure doesn't block remaining subscriptions - Log failed subscriptions with new 'cashbox_export_subscription_run_fail' event - Add new LOGEVENT type for subscription run failures - Add test to verify second subscription processes even when first fails (continues processing independently) - All 7 tests passing: 6 original + 1 new failure handling test Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -35,7 +35,16 @@ export class CashboxExportScheduler {
|
||||
});
|
||||
|
||||
for (const subscription of due) {
|
||||
await this.runOne(subscription);
|
||||
try {
|
||||
await this.runOne(subscription);
|
||||
} catch (error) {
|
||||
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||
await this.logger.error({
|
||||
event: 'cashbox_export_subscription_run_fail',
|
||||
details: `recurring subscription failed: subscriptionId=${subscription.id} teamId=${subscription.team.id}: ${errorMessage}`,
|
||||
userId: -1,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user