error throwing for login

Created basic handling of errors. Still primitive. Will improve later.