You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For now, we set the conversion factor to NaN in case of ANY errors (e.g. http request failed, parsing failed, etc). How can we properly handle errors here?
The text was updated successfully, but these errors were encountered:
When we see an error that indicates that the user wants to use one of the currency units from units::currencies (e.g. unknown identifier 'USD', where we would look out for all identifiers that the module defines), we suppress that error message, and try to load the currency exchange rates synchronously.
If fetching exchange rates (or parsing the XML) fails for some reason, we show a runtime error message ("could not fetch …"). We do not show the "unknown identifier …" message.
If fetching exchange rates succeeds, we then load the units::currencies module and subsequently re-try to evaluate the user expression. This time, it should succeed.
This solves multiple problems:
Proper error messages in case fetching exchange rates fails. No NaN values.
No need to bother the user with "could not fetch…" messages if they don't want to work with currencies
No asynchronous loading of modules (we might even be able to get rid of some synchronization mechanisms?)
Consequently, no problems with immediate availability of currency units (numbat -e '150 € to $ would work)
Disadvantages:
we need to know all identifiers that the units::currencies module provides.
For now, we set the conversion factor to
NaN
in case of ANY errors (e.g. http request failed, parsing failed, etc). How can we properly handle errors here?The text was updated successfully, but these errors were encountered: