Skip to content

Commit

Permalink
Merge pull request #20990 from storybookjs/shilman/hash-error-message
Browse files Browse the repository at this point in the history
Telemetry: Hash error messages
  • Loading branch information
shilman authored Feb 8, 2023
2 parents 10e1549 + a768b28 commit 742f878
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions code/lib/core-server/src/withTelemetry.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import prompts from 'prompts';
import type { CLIOptions, CoreConfig } from '@storybook/types';
import { loadAllPresets, cache } from '@storybook/core-common';
import { telemetry, getPrecedingUpgrade } from '@storybook/telemetry';
import { telemetry, getPrecedingUpgrade, oneWayHash } from '@storybook/telemetry';
import type { EventType } from '@storybook/telemetry';

type TelemetryOptions = {
Expand Down Expand Up @@ -76,7 +76,12 @@ export async function withTelemetry(

await telemetry(
'error',
{ eventType, precedingUpgrade, error: errorLevel === 'full' ? error : undefined },
{
eventType,
precedingUpgrade,
error: errorLevel === 'full' ? error : undefined,
errorHash: oneWayHash(error.message),
},
{
immediate: true,
configDir: options.cliOptions.configDir || options.presetOptions?.configDir,
Expand Down
2 changes: 2 additions & 0 deletions code/lib/telemetry/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { sendTelemetry } from './telemetry';
import { notify } from './notify';
import { sanitizeError } from './sanitize';

export { oneWayHash } from './one-way-hash';

export * from './storybook-metadata';

export * from './types';
Expand Down

0 comments on commit 742f878

Please sign in to comment.