honza / node-thumbnail

Thumbnail worker queue for node.js
http://honza.ca/node-thumbnail/
Other
103 stars 23 forks source link

Fix TypeError involving logger #15

Closed oksas closed 7 years ago

oksas commented 7 years ago

It looks like the module still functions/does the thumbnail conversion, but the error TypeError: options.logger is not a function was being thrown whenever the module is trying to log something. It happens both here and further down the file here as well. This line appears to be where default properties get overridden by any user options, but its location in that if block means that if sibling else if blocks are executed, the logger is not on the options object unless the user explicitly provides one.

The two options for fixing this that came to mind are:

I opted for the first because of the issue mentioned in the second, but let me know what you think! The issue on line 127 was fixed simply by changing options.logger to settings.logger since options in that area seems to be referencing something separate.

honza commented 7 years ago

I'm not very smart. Thanks!

oksas commented 7 years ago

Hahah no worries. It seems like it might be worthwhile to add even some basic unit tests to the module at some point, to catch stuff like this more easily.