Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/crash/crash-api-client/crash-api-client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ describe('CrashApiClient', () => {
await client.reprocessCrash(database, 0);
fail('reprocessCrash was supposed to throw!');
} catch (error: any) {
expect(error.message).toMatch(/to be a positive non-zero number/);
expect(error.message).toMatch(/to be positive non-zero numbers/);
}
});
});
Expand Down
13 changes: 10 additions & 3 deletions src/crash/crash-api-client/crash-api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,22 @@ export class CrashApiClient {
}

async reprocessCrash(database: string, crashId: number, force = false, processor = ''): Promise<SuccessResponse> {
return this.reprocessCrashes(database, [crashId], force, processor);
}

async reprocessCrashes(database: string, crashIds: Array<number>, force = false, processor = ''): Promise<SuccessResponse> {
ac.assertNonWhiteSpaceString(database, 'database');
ac.assertBoolean(force, 'force');
if (crashId <= 0) {
throw new Error(`Expected id to be a positive non-zero number. Value received: "${crashId}"`);

for (const crashId of crashIds) {
if (crashId <= 0) {
throw new Error(`Expected ids to be positive non-zero numbers. Value received: "${crashId}"`);
}
}

const formData = this._client.createFormData();
formData.append('database', database);
formData.append('id', crashId.toString());
formData.append('id', crashIds.join(','));
formData.append('force', force.toString());
if (processor) {
formData.append('processor', processor);
Expand Down