Skip to content

Commit 737e2c3

Browse files
authored
fix: post with crashTypeId (#117)
1 parent 27d44bf commit 737e2c3

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/post/crash-post-client.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ describe('CrashPostClient', () => {
7676
expect(fakeFormData.append).toHaveBeenCalledWith('database', database);
7777
expect(fakeFormData.append).toHaveBeenCalledWith('appName', application);
7878
expect(fakeFormData.append).toHaveBeenCalledWith('appVersion', version);
79-
expect(fakeFormData.append).toHaveBeenCalledWith('crashType', type);
79+
expect(fakeFormData.append).toHaveBeenCalledWith('crashType', type.name);
80+
expect(fakeFormData.append).toHaveBeenCalledWith('crashTypeId', `${type.id}`);
8081
expect(fakeFormData.append).toHaveBeenCalledWith('s3key', url);
8182
expect(fakeFormData.append).toHaveBeenCalledWith('md5', md5);
8283
expect(bugsplatApiClient.fetch).toHaveBeenCalledWith(

src/post/crash-post-client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ export class CrashPostClient {
8383
formData.append('database', database);
8484
formData.append('appName', application);
8585
formData.append('appVersion', version);
86-
formData.append('crashType', crashType);
86+
formData.append('crashType', crashType.name);
87+
formData.append('crashTypeId', `${crashType.id}`);
8788
formData.append('s3key', s3Key);
8889
formData.append('md5', md5);
8990

src/post/crash-type.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
export enum CrashType {
2-
native = 'Windows.Native',
3-
dotnet = 'Windows.NET'
1+
export class CrashType {
2+
static readonly crashpad = new CrashType('Crashpad', 5);
3+
static readonly dotnet = new CrashType('Windows.NET', 8);
4+
static readonly electron = new CrashType('Electron', 22);
5+
static readonly native = new CrashType('Windows.Native', 1);
6+
private constructor(public readonly name: string, public readonly id: number) { }
47
}

0 commit comments

Comments
 (0)