fix: Handle errors properly when loading Moment Locale
Proposed changes (including videos or screenshots)
-
BUGFIX: Use
awaitwhen calling async function Assets.getTextAsync()Commit df82bccb86fdab509c9de324ad4adfda93f0ddc1 "chore: Use Assets’ async API (#29311)" replaced several
Assets.getText()calls withawait Assets.getTextAsync(). One of those getTextAsync calls was not awaited.That one was especially problematic in that it is in a try/catch block, however you cannot try/catch a Promise, so we missed handling that error. You must either try/catch the awaited Promise or chain on a Promise#catch handler.
-
Meteor method loadLocale: Allow getMomentLocale() exceptions to pass-through
Do not try/catch
getMomentLocale():- It is an async function. You cannot try/catch Promises, so this try/catch has been a NOOP for years already. We apparently don't need it.
- getMomentLocale() already handles exceptions and raises an (almost?) identical exception already.
Issue(s)
Steps to test or reproduce
- Configure
Log_Exceptions_to_Channelwith a channel name - In user preferences, change the Language to "Norwegian Bokmål (Norway)"
- In the exceptions channel, it will say:
Exception while invoking method loadLocale > Error: Unknown asset: moment-locales/nb-no.js - Change the language to Default
- Apply the PR
- Change the language back again to "Norwegian Bokmål (Norway)"
-
loadLocalewill successfully load thenb.jsMoment Locale file (sans-nocountry)
Further comments
Looks like this PR is not ready to merge, because of the following issues:
- This PR is missing the 'stat: QA assured' label
- This PR is missing the required milestone or project
Please fix the issues and try again
If you have any trouble, please check the PR guidelines
⚠️ No Changeset found
Latest commit: c8f03cfb8374640615ccf987e16bf121d52ea9d1
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR