More logs when fire decoding fails

This commit is contained in:
vjrj 2018-05-10 09:52:30 +02:00
parent 2d19778553
commit b7930eeb0e
2 changed files with 10 additions and 3 deletions

View file

@ -132,14 +132,20 @@ Meteor.publish('fireFromId', function fireFromId(_id) {
} }
}); });
Meteor.publish('fireFromHash', function fireFromHash(fireEnc) { function logUrl(fireEnc, params) {
console.log(`Wrong fire: ${fireEnc}.`);
console.log(`Params received in url: ${JSON.stringify(params)}`);
}
Meteor.publish('fireFromHash', function fireFromHash(fireEnc, params) {
check(fireEnc, String); check(fireEnc, String);
check(params, Object);
try { try {
// console.log(fireEnc); // console.log(fireEnc);
// const unsealed = Promise.await(urlEnc.decrypt(fireEnc)); // const unsealed = Promise.await(urlEnc.decrypt(fireEnc));
const unsealed = Promise.await(unsealW(fireEnc)); const unsealed = Promise.await(unsealW(fireEnc));
if (unsealed === undefined) { if (unsealed === undefined) {
console.info(`Wrong fire: ${fireEnc}`); logUrl(fireEnc, params);
// https://guide.meteor.com/data-loading.html // https://guide.meteor.com/data-loading.html
return this.ready(); return this.ready();
} }
@ -158,6 +164,7 @@ Meteor.publish('fireFromHash', function fireFromHash(fireEnc) {
* return fire; */ * return fire; */
} catch (e) { } catch (e) {
console.warn(e); console.warn(e);
logUrl(fireEnc, params);
return this.ready(); return this.ready();
} }
}); });

View file

@ -278,7 +278,7 @@ const FireContainer = withTracker(({ match }) => {
} else { } else {
console.log('Seems a fire from enc hash'); console.log('Seems a fire from enc hash');
fromHash = true; fromHash = true;
subscription = Meteor.subscribe('fireFromHash', id); subscription = Meteor.subscribe('fireFromHash', id, match.params);
} }
// console.log(`Type of '${fireType}' fire, active: ${active}, archive: ${archive}, fromHash: ${fromHash}`); // console.log(`Type of '${fireType}' fire, active: ${active}, archive: ${archive}, fromHash: ${fromHash}`);