Tuesday, 11 February 2020

Thoughts on moment.js not throwing errors at all

Creating a moment object by calling moment(undefined) or moment(something-stupid) never throws an error. Instead, the object returned will have a method isValid() which will be false.Do you think it is a good practice for libraries to not throw an error and provide a different mechanism for sanity checks like this? Or should a library should throw errors.

Submitted February 12, 2020 at 02:12AM by vikrant0

No comments:

Post a Comment