Code tidyup for login resource
Add some rudimentary error handling for request handlers