-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add error handling to all public apis (#1907)
* feat: add error handling to all public apis * chore: address ai bot review comments * test: add unit tests for RudderAnalytics class * fix: buble up error to handle * fix: error handling in analytics * test: address ai bot review comments * test: add unit tests for error utilities * test: clean up test suite * chore: revert size limit changes * chore: update code owners and slack group for integrations * fix: log manually raised unhandled errors * fix: improve stack mutation logic
- Loading branch information
1 parent
79cad80
commit 9fbaf81
Showing
16 changed files
with
995 additions
and
432 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
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
Validating CODEOWNERS rules …
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
* @rudderlabs/js-sdk | ||
|
||
/packages/analytics-js-integrations/src/ @rudderlabs/js-sdk-dm-intg-eng | ||
/packages/analytics-js-integrations/__fixtures__/ @rudderlabs/js-sdk-dm-intg-eng | ||
/packages/analytics-js-integrations/__tests__/ @rudderlabs/js-sdk-dm-intg-eng | ||
/packages/analytics-js-integrations/__mocks__/ @rudderlabs/js-sdk-dm-intg-eng | ||
/packages/analytics-js-integrations/README.md @rudderlabs/js-sdk-dm-intg-eng | ||
/packages/analytics-js-integrations/.size-limit.js @rudderlabs/js-sdk-dm-intg-eng | ||
/packages/analytics-js-integrations/src/ @rudderlabs/integrations | ||
/packages/analytics-js-integrations/__fixtures__/ @rudderlabs/integrations | ||
/packages/analytics-js-integrations/__tests__/ @rudderlabs/integrations | ||
/packages/analytics-js-integrations/__mocks__/ @rudderlabs/integrations | ||
/packages/analytics-js-integrations/README.md @rudderlabs/integrations | ||
/packages/analytics-js-integrations/.size-limit.js @rudderlabs/integrations | ||
|
||
/packages/analytics-js-common/src/constants/integrations/ @rudderlabs/js-sdk-dm-intg-eng | ||
/assets/integrations/AdobeAnalytics/ @rudderlabs/js-sdk-dm-intg-eng | ||
/examples/integrations/ @rudderlabs/js-sdk-dm-intg-eng | ||
/packages/analytics-js-common/src/constants/integrations/ @rudderlabs/integrations | ||
/assets/integrations/AdobeAnalytics/ @rudderlabs/integrations | ||
/examples/integrations/ @rudderlabs/integrations |
18 changes: 18 additions & 0 deletions
18
packages/analytics-js-common/__tests__/utilities/errors.test.ts
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,18 @@ | ||
import { dispatchErrorEvent } from '../../src/utilities/errors'; | ||
|
||
describe('Errors - utilities', () => { | ||
describe('dispatchErrorEvent', () => { | ||
it('should dispatch an error event', () => { | ||
const dispatchEvent = jest.fn(); | ||
const originalDispatchEvent = globalThis.dispatchEvent; | ||
|
||
globalThis.dispatchEvent = dispatchEvent; | ||
const error = new Error('Test error'); | ||
dispatchErrorEvent(error); | ||
expect(dispatchEvent).toHaveBeenCalledWith(new ErrorEvent('error', { error })); | ||
|
||
// Cleanup | ||
globalThis.dispatchEvent = originalDispatchEvent; | ||
}); | ||
}); | ||
}); |
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
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
Oops, something went wrong.