gentooboontoo / js-quantities

JavaScript library for quantity calculation and unit conversion
http://gentooboontoo.github.io/js-quantities/
MIT License
396 stars 102 forks source link

How to get error messages? #82

Open librilex opened 7 years ago

librilex commented 7 years ago

Hi, I just started to work with js-quantities and haven't figured out how to get error messages. If something goes wrong (e.g. when Qty('1 Amporia') was entered), only the message [object] [Object] appears in the console of my web browser (Firefox). It would be nice if I could get more information on what went wrong if an error occurs.

(tested with v1.6.6)

rage-shadowman commented 7 years ago

The error thrown is not a string. It is an object with members name, message, and stack. Maybe try printing out the errors message property?

rage-shadowman commented 7 years ago

See the file: src/quantities/error.js