openexchangerates / money.js

money.js is a tiny (1kb) javascript currency conversion library, for web & nodeJS
http://openexchangerates.github.io/money.js
MIT License
1.46k stars 127 forks source link

Throw actual Error instance and improve error message #24

Open ragulka opened 8 years ago

ragulka commented 8 years ago

Related to #8 and #13

Only Error instances in JavaScript provide a stack - this is why there is no stack available, because a simple string is thrown. This PR addresses this issue by throwing an actual Error instance and providing a more detail error message, such as: Cannot convert EUR to USD: exchange rate for USD is missing.