-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release-8-0' into norbert/remove-storyshots
- Loading branch information
Showing
5 changed files
with
38 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { global } from '@storybook/global'; | ||
|
||
import { TELEMETRY_ERROR } from '@storybook/core-events'; | ||
|
||
import { values } from './globals/runtime'; | ||
import { Keys } from './globals/types'; | ||
import { prepareForTelemetry, shouldSkipError } from './utils/prepareForTelemetry'; | ||
|
||
// Apply all the globals | ||
Object.keys(Keys).forEach((key: keyof typeof Keys) => { | ||
global[Keys[key]] = values[key]; | ||
}); | ||
|
||
global.sendTelemetryError = (error) => { | ||
if (!shouldSkipError(error)) { | ||
const channel = global.__STORYBOOK_ADDONS_CHANNEL__; | ||
channel.emit(TELEMETRY_ERROR, prepareForTelemetry(error)); | ||
} | ||
}; | ||
|
||
// handle all uncaught errors at the root of the application and log to telemetry | ||
global.addEventListener('error', (args) => { | ||
const error = args.error || args; | ||
global.sendTelemetryError(error); | ||
}); | ||
global.addEventListener('unhandledrejection', ({ reason }) => { | ||
global.sendTelemetryError(reason); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters