Skip to content

Commit

Permalink
chore: review comment address
Browse files Browse the repository at this point in the history
  • Loading branch information
MoumitaM committed Jul 18, 2024
1 parent 0651b04 commit 017be47
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,4 @@ describe('Plugin - ErrorReporting', () => {

expect(state.reporting.breadcrumbs.value.length).toBe(breadcrumbLength + 1);
});

it('should not add a new breadcrumb if the message is missing', () => {
const breadcrumbLength = state.reporting.breadcrumbs.value.length;
ErrorReporting().errorReporting.breadcrumb({}, undefined, undefined, undefined, state);

expect(state.reporting.breadcrumbs.value.length).not.toBe(breadcrumbLength + 1);
});
});
7 changes: 2 additions & 5 deletions packages/analytics-js-plugins/src/errorReporting/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ const ErrorReporting = (): ExtensionPlugin => ({
pluginEngine: IPluginEngine,
externalSrcLoader: IExternalSrcLoader,
logger?: ILogger,
flag?: boolean,
isInvokedFromLatestCore?: boolean,
) => {
if (flag) {
if (isInvokedFromLatestCore) {
return undefined;

Check warning on line 50 in packages/analytics-js-plugins/src/errorReporting/index.ts

View check run for this annotation

Codecov / codecov/patch

packages/analytics-js-plugins/src/errorReporting/index.ts#L50

Added line #L50 was not covered by tests
}
if (!state.source.value?.config || !state.source.value?.id) {
Expand Down Expand Up @@ -118,9 +118,6 @@ const ErrorReporting = (): ExtensionPlugin => ({
state?: ApplicationState,
metaData?: BreadcrumbMetaData,
): void => {
if (!message) {
return;
}
if (state) {
state.reporting.breadcrumbs.value = [
...state.reporting.breadcrumbs.value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class ErrorHandler implements IErrorHandler {
notifyError(error: SDKError, errorState: ErrorState) {
if (this.pluginEngine && isAllowedToBeNotified(error)) {
try {
this.pluginEngine?.invokeSingle(
this.pluginEngine.invokeSingle(
'errorReporting.notify',
this.pluginEngine, // deprecated parameter
this.errReportingClient, // deprecated parameter
Expand Down

0 comments on commit 017be47

Please sign in to comment.