Skip to content

Commit

Permalink
Track dev-env-import-sql commands properly (#1557)
Browse files Browse the repository at this point in the history
  • Loading branch information
aswasif007 authored Nov 13, 2023
1 parent b4e542e commit 80de030
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/bin/vip-dev-env-import-sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
handleCLIException,
getEnvironmentName,
} from '../lib/dev-environment/dev-environment-cli';
import { trackEvent } from '../lib/tracker';
import { makeCommandTracker } from '../lib/tracker';

const examples = [
{
Expand Down Expand Up @@ -44,12 +44,15 @@ command( {
const slug = await getEnvironmentName( opt );
const cmd = new DevEnvImportSQLCommand( fileName, opt, slug );
const trackingInfo = getEnvTrackingInfo( cmd.slug );
const trackerFn = makeCommandTracker( 'dev_env_import_sql', trackingInfo );
await trackerFn( 'execute' );

try {
await cmd.run();
await trackEvent( 'dev_env_import_sql_command_success', trackingInfo );
await trackerFn( 'success' );
} catch ( error ) {
await handleCLIException( error, 'dev_env_import_sql_command_error', trackingInfo );
await handleCLIException( error );
await trackerFn( 'error', { message: error.message, stack: error.stack } );
process.exitCode = 1;
}
} );
1 change: 0 additions & 1 deletion src/commands/dev-env-import-sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export class DevEnvImportSQLCommand {
fileName;
options;
slug;
trackingInfo;

constructor( fileName, options, slug ) {
this.fileName = fileName;
Expand Down

0 comments on commit 80de030

Please sign in to comment.