Skip to content
Snippets Groups Projects
Commit e720bcf6 authored by Chad Pilkey's avatar Chad Pilkey
Browse files

fix html5 server exceptions

parent c71de81b
No related branches found
No related tags found
No related merge requests found
import Logger from '/imports/startup/server/logger';
import Users from '/imports/api/users';
const logClient = function (type, logDescription, logCode = 'was_not_provided', extraInfo, userInfo = {}) {
const logClient = function (type, logDescription, logCode = 'was_not_provided', extraInfo = {}, userInfo = {}) {
const SERVER_CONN_ID = this.connection.id;
const User = Users.findOne({ connectionId: SERVER_CONN_ID });
const logContents = {
......
......@@ -25,6 +25,7 @@ export default function publishVote(credentials, id, pollAnswerId) { // TODO dis
check(meetingId, String);
check(requesterUserId, String);
check(pollAnswerId, Number);
check(currentPoll, Object);
check(currentPoll.meetingId, String);
const payload = {
......
......@@ -152,6 +152,14 @@ WebApp.connectHandlers.use('/feedback', (req, res) => {
authToken,
});
if (!user) {
Logger.error(`Feedback failed, user with id=${userId} wasn't found`);
res.setHeader('Content-Type', 'application/json');
res.writeHead(500);
res.end(JSON.stringify({ status: 'ok' }));
return;
}
const feedback = {
userName: user.name,
...body,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment