From db5b86df4c735a4ed80e1ae683dc58e15f819e0b Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Fri, 27 Jul 2018 13:56:07 +0200 Subject: Further improvement of error handling for LZString This does some more in depth check on the error message and minimizes the log noise that is caused by LZString. Signed-off-by: Sheogorath --- lib/models/note.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/models/note.js') diff --git a/lib/models/note.js b/lib/models/note.js index ec7e2b13..0e8dd4dd 100644 --- a/lib/models/note.js +++ b/lib/models/note.js @@ -227,7 +227,11 @@ module.exports = function (sequelize, DataTypes) { var id = LZString.decompressFromBase64(noteId) if (id && Note.checkNoteIdValid(id)) { return callback(null, id) } else { return _callback(null, null) } } catch (err) { - logger.error(err) + if (err.message === 'Cannot read property \'charAt\' of undefined') { + logger.warning('Looks like we can not decode "' + noteId + '" with LZString. Can be ignored.') + } else { + logger.error(err) + } return _callback(null, null) } }, -- cgit v1.2.3