mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-11-01 18:19:43 +00:00
fix(mobile): record xprem_js_crash only for fatal JS errors
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
659cee76b6
commit
5c4a4608b1
2 files changed
+29
-12
No files matched your search
@@ -75,12 +75,26 @@ describe('observe', () => {
|
||||
expect.objectContaining({
|
||||
severity: 'fatal',
|
||||
body: 'boom',
|
||||
attributes: { isFatal: true },
|
||||
})
|
||||
);
|
||||
expect(previousHandler).toHaveBeenCalledWith(error, true);
|
||||
});
|
||||
|
||||
it('does not log xprem_js_crash for non-fatal errors but still delegates', () => {
|
||||
const previousHandler = jest.fn();
|
||||
const getInstalledHandler = installFakeErrorUtils(previousHandler);
|
||||
|
||||
withFreshObserveModule(({ installObserveGlobalErrorHandler }) => {
|
||||
installObserveGlobalErrorHandler();
|
||||
});
|
||||
|
||||
const error = new Error('handled');
|
||||
getInstalledHandler()(error, false);
|
||||
|
||||
expect(logEventMock).not.toHaveBeenCalled();
|
||||
expect(previousHandler).toHaveBeenCalledWith(error, false);
|
||||
});
|
||||
|
||||
it('still calls the previous handler when Observe.logEvent throws', () => {
|
||||
const previousHandler = jest.fn();
|
||||
const getInstalledHandler = installFakeErrorUtils(previousHandler);
|
||||
@@ -92,8 +106,8 @@ describe('observe', () => {
|
||||
installObserveGlobalErrorHandler();
|
||||
});
|
||||
|
||||
getInstalledHandler()(new Error('boom'), false);
|
||||
getInstalledHandler()(new Error('boom'), true);
|
||||
|
||||
expect(previousHandler).toHaveBeenCalledWith(expect.any(Error), false);
|
||||
expect(previousHandler).toHaveBeenCalledWith(expect.any(Error), true);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user