Facebook Login Cancel button leads to a server error

I’ve successfully implemented the Facebook login integration, but whenever the user cancels the login it takes user back to a server error which I’m unable to trace.

On clicking this cancel button

User is taken to a server error page

Can anyone help me, how to avoid this bug.