postleaf icon indicating copy to clipboard operation
postleaf copied to clipboard

Error logs

Open nextlogic-ono opened this issue 7 years ago • 3 comments
trafficstars

Summary

Can you try to print out error logs to the console when an error occurs? You seem to discard 'err' variables and it's hard to debug with no information.

I tried to upload an image and it failed with no logging. It turned out that I hadn't installed 'gm' command but it could be better if 'err' content was printed in the server as console.error.

Steps to Reproduce

  1. Do not install graphicsmagick
  2. node app
  3. Upload an image

Additional info

  • Postleaf version: 1.0.0-beta.1
  • Node version: 8.9.4
  • Affected browsers:
  • Operating system: Ubuntu 16.04

nextlogic-ono avatar Jan 26 '18 04:01 nextlogic-ono

I'm open to discussing a PR for this, perhaps using Morgan or a similar lib.

claviska avatar Jan 27 '18 03:01 claviska

Not sure what fits the best to have good logging but for example, in 'source/controllers/api/uploads_controller.js',

198 : .write(req.file.path, (err) => { 199 : if(err) { 200 : res.status(HttpCodes.BAD_REQUEST); 201 : return next(I18n.term('sorry_but_i_cant_seem_to_process_this_image')); 202 : }

'err' is not used and the only message I get is that it didn't work out well but if you can even simply 'console.error(`Saving the image to a file failed : ${err}`)', this will let people figure out what just happened.

nextlogic-ono avatar Jan 27 '18 04:01 nextlogic-ono

That's definitely true for a dev environment where you have the console available — and I fully agree better error messages need to be in place (even if just for the user). Thanks for pointing this out.

claviska avatar Jan 27 '18 04:01 claviska