Skip to content

Commit

Permalink
Merge pull request #201 from swellstores/fix/improve-settings-error
Browse files Browse the repository at this point in the history
fix: improve settings error
  • Loading branch information
awwit authored Jan 27, 2025
2 parents e558122 + d4917ef commit 8cb29ee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/currency.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ const mockSettingState = {

describe('currency', () => {
beforeEach(() => {
if (typeof navigator !== 'undefined') {
jest.spyOn(navigator, 'language', 'get').mockReturnValue('en-US');
}

api.init('test', 'pk_test');
api.settings.state = JSON.parse(JSON.stringify(mockSettingState));
api.currency.code = null;
Expand Down
6 changes: 5 additions & 1 deletion src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ function methods(api, opt) {
value: session,
});
} catch (err) {
console.error(`Swell: unable to load settings (${err})`);
if (err instanceof Error) {
err.message = `Swell: unable to load settings (${err.message})`;
}

console.error(err);
}
},
};
Expand Down

0 comments on commit 8cb29ee

Please sign in to comment.