You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
console.error('An error occurred while finding one and updating PollVote with filter filtering by userId:',userId,'and pollId:',pollId,'and update query updating dateVoted to Date.now() and vote to:',optionSelected,'and upserts are enabled. The error was:',error)
652
-
returnresolve(HTTPWTHandler.serverError('An error occurred while adding vote to the poll. Please try again.'))
653
-
})
654
-
}else{
655
-
returnresolve(HTTPWTHandler.notFound('Could not find poll'))
console.error('An error occured while finding poll with id:',pollId,'. The error was:',error)
659
-
returnresolve(HTTPWTHandler.serverError('An error occurred while finding poll. Please try again.'))
636
+
console.error('An error occurred while finding one and updating PollVote with filter filtering by userId:',userId,'and pollId:',pollId,'and update query updating dateVoted to Date.now() and vote to:',optionSelected,'and upserts are enabled. The error was:',error)
637
+
returnresolve(HTTPWTHandler.serverError('An error occurred while adding vote to the poll. Please try again.'))
660
638
})
661
-
}else{
662
-
returnresolve(HTTPWTHandler.notFound('Could not find user with provided userId'))
663
-
}
639
+
}).catch(error=>{
640
+
console.error('An error occured while finding poll with id:',pollId,'. The error was:',error)
641
+
returnresolve(HTTPWTHandler.serverError('An error occurred while finding poll. Please try again.'))
642
+
})
664
643
}).catch(error=>{
665
644
console.error('An error occured while finding user with id:',userId,'. The error was:',error)
666
645
returnresolve(HTTPWTHandler.serverError('An error occurred while finding user with your id. Please try again.'))
@@ -682,6 +661,10 @@ class TempController {
682
661
returnresolve(HTTPWTHandler.badInput(`pollId must be a string. Provided type: ${typeofpollId}`))
683
662
}
684
663
664
+
if(!mongoose.isObjectIdOrHexString(pollId)){
665
+
returnresolve(HTTPWTHandler.badInput('pollId must be an ObjectId.'))
0 commit comments