Skip to content

Commit

Permalink
Add event tracking for PMA enable failures (#1667)
Browse files Browse the repository at this point in the history
* Add event tracking for PMA enable failures

* Refactor

* Bring back empty line

* Print progress steps properly on error scenarios

---------

Co-authored-by: Ahmed Sayeed Wasif <[email protected]>
  • Loading branch information
saroshaga and aswasif007 authored Jan 26, 2024
1 parent c0b6cc1 commit 736a9ca
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/commands/phpmyadmin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class PhpMyAdminCommand {
this.env = env;
this.track = trackerFn;
this.progressTracker = new ProgressTracker( [
{ id: this.steps.ENABLE, name: 'Enabling PHPMyAdmin for this site' },
{ id: this.steps.ENABLE, name: 'Enabling PHPMyAdmin for this environment' },
{ id: this.steps.GENERATE, name: 'Generating access link' },
] );
}
Expand Down Expand Up @@ -198,6 +198,15 @@ export class PhpMyAdminCommand {
this.progressTracker.stepSuccess( this.steps.ENABLE );
} catch ( err ) {
this.progressTracker.stepFailed( this.steps.ENABLE );
const error = err as Error & {
graphQLErrors?: GraphQLFormattedError[];
};
void this.track( 'error', {
error_type: 'enable_pma',
error_message: error.message,
stack: error.stack,
} );
this.stopProgressTracker();
exit.withError( 'Failed to enable PhpMyAdmin' );
}

Expand All @@ -216,6 +225,7 @@ export class PhpMyAdminCommand {
error_message: error.message,
stack: error.stack,
} );
this.stopProgressTracker();
exit.withError( `Failed to generate PhpMyAdmin URL: ${ error.message }` );
}

Expand Down

0 comments on commit 736a9ca

Please sign in to comment.