mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-09-11 12:25:42 +03:00
Capture push and pr success/failure in posthog
- just a start since we currently are not getting much data on this
This commit is contained in:
parent
f7fd92f4e0
commit
167b0b5a4d
@ -9,6 +9,7 @@ import {
|
||||
import { sleep } from '$lib/utils/sleep';
|
||||
import * as toasts from '$lib/utils/toasts';
|
||||
import lscache from 'lscache';
|
||||
import posthog from 'posthog-js';
|
||||
import {
|
||||
Observable,
|
||||
EMPTY,
|
||||
@ -187,15 +188,17 @@ export class GitHubService {
|
||||
draft
|
||||
});
|
||||
await this.reload();
|
||||
posthog.capture('PR Successful');
|
||||
return { pr: ghResponseToInstance(rsp.data) };
|
||||
} catch (err: any) {
|
||||
posthog.capture('PR Failed', { error: err });
|
||||
// Any error that should not be retried needs to be handled here.
|
||||
if (
|
||||
err.status == 422 &&
|
||||
err.message.includes('Draft pull requests are not supported')
|
||||
)
|
||||
) {
|
||||
return { err: 'Draft pull requests are not enabled in your repository' };
|
||||
else throw err;
|
||||
} else throw err;
|
||||
}
|
||||
})
|
||||
)
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { invoke } from '$lib/backend/ipc';
|
||||
import * as toasts from '$lib/utils/toasts';
|
||||
import posthog from 'posthog-js';
|
||||
import type { RemoteBranchService } from '$lib/stores/remoteBranches';
|
||||
import type { BaseBranchService, VirtualBranchService } from './branchStoresCache';
|
||||
import type { Branch, Hunk } from './types';
|
||||
@ -58,8 +59,10 @@ export class BranchController {
|
||||
ownership,
|
||||
runHooks: runHooks
|
||||
});
|
||||
posthog.capture('Commit Successful');
|
||||
} catch (err) {
|
||||
toasts.error('Failed to commit branch');
|
||||
posthog.capture('Commit Failed');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ import { BaseBranch, Branch } from './types';
|
||||
import { invoke, listen } from '$lib/backend/ipc';
|
||||
import * as toasts from '$lib/utils/toasts';
|
||||
import { plainToInstance } from 'class-transformer';
|
||||
import posthog from 'posthog-js';
|
||||
import {
|
||||
switchMap,
|
||||
Observable,
|
||||
@ -108,9 +109,11 @@ export class VirtualBranchService {
|
||||
branchId,
|
||||
withForce
|
||||
});
|
||||
posthog.capture('Push Successful');
|
||||
await this.reload();
|
||||
return await this.getById(branchId);
|
||||
} catch (err: any) {
|
||||
posthog.capture('Push Failed', { error: err });
|
||||
if (err.code === 'errors.git.authentication') {
|
||||
toasts.error('Failed to authenticate. Did you setup GitButler ssh keys?');
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user