angular-dynamic-layout
angular-dynamic-layout copied to clipboard
When throwing errors Error object should be used
When throwing errors I think the Error object should be used instead of just throwing a message string:
Instead of this: position.service.js .... if (item.columnSpan > colHeights.length) { throw 'Item too large'; } ...
an Error object should be thrown: ... if (item.columnSpan > colHeights.length) { throw new Error('Item too large'); } ...
When throwing just string any code that handles exception will receive a string and not as expected an Error object.
Yes that is better practice