Skip to content

Commit

Permalink
refactor: log warning instead error when a storage capability is unav…
Browse files Browse the repository at this point in the history
…ailable (#1638)
  • Loading branch information
MoumitaM authored Mar 6, 2024
1 parent 56eb22a commit c9abc60
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/analytics-js-plugins/__fixtures__/msw.handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ const handlers = [
status: 500,
});
}),
http.get(`https://asdf.com/bugsnag.min.js`, () => {
return new HttpResponse(errorMessage, {
status: 404,
});
}),
];

export { handlers };
8 changes: 8 additions & 0 deletions packages/analytics-js-plugins/__tests__/bugsnag/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
onError,
getAppStateForMetadata,
} from '../../src/bugsnag/utils';
import { server } from '../../__fixtures__/msw.server';

describe('Bugsnag utilities', () => {
describe('isApiKeyValid', () => {
Expand Down Expand Up @@ -263,6 +264,13 @@ describe('Bugsnag utilities', () => {
});

describe('loadBugsnagSDK', () => {
beforeAll(() => {
server.listen();
});

afterAll(() => {
server.close();
});
let insertBeforeSpy: any;

class MockLogger implements ILogger {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const isStorageAvailable = (
if (isStorageQuotaExceeded(err)) {
reason = 'full';
}
logger?.error(`${msgPrefix}${reason}.`, err);
logger?.warn(`${msgPrefix}${reason}.`, err);
return false;
}
};
Expand Down

0 comments on commit c9abc60

Please sign in to comment.